Re: alternate event logging proposal

Tim Hockin (thockin@sun.com)
Tue, 24 Sep 2002 16:59:24 -0700


Brad Hards wrote:

>>You really want something where a userspace app can sleep on an fd, to
>>be awakened when link changes (or some other interesting event occurs)
>
> Maybe - I've been thinking of a "hotplug" daemon, that can take notifications
> from the kernel _and_ from other userspace apps. The integrated solution
> somehow needs to incorporate device hotplugging (eg USB, PCI), network device
> events (netlink), userspace reconfiguration (eg X colour depth and
> resolution) and maybe network infrastructure (external to the machine,
> probably SLPv2 or similar), and reconfigure kernel and applications to match.

See my previous about acpid - it is capable of most of this. In short:

Open kernel event file
read config files: map regexes to actions
open a named UNIX socket
while 1
wait for event or data on socket
if it's an event {
read event
for each config'ed regex {
if it matches this event
run the associated action
}
for each UNIX connection {
notify the connection of the event
}
} else if it's a connection on the socket {
add the connection to the list of notifications
}
}

Now it would be easy to make UNIX-connecting apps specify one or more
regexes, instead of getting broadcasted. It would be similarly easy to
make it read multiple sources and handle that - acpi, dev_events,
user_events (UNIX socket or FIFO).

http://acpid.sourceforge.net - it's kind of stale, because it does
everything it needs to do for now :) It's small, well tested and easy
to understand. Best of all, it's already written.

Tim

-- 
Tim Hockin
Systems Software Engineer
Sun Microsystems, Linux Kernel Engineering
thockin@sun.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/