Re: alternate event logging proposal

Tim Hockin
2002-09-24T23:54:15Z

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