s6-linux-utils
Software
skarnet.org
The s6-uevent-listener program
s6-uevent-listener spawns a long-lived helper program.
It then listens to the netlink interface for uevents (also called
"hotplug" or "udev" events), and passes those events to the
helper program's standard input, using a simple format.
Interface
s6-uevent-listener [ -v verbosity ] [ -b kbufsz ] prog...
- s6-uevent-listener spawns prog... with a pipe writing to
prog' stdin.
- s6-uevent-listener binds to the netlink interface and listens for
hotplug events, as the udev program does.
- It transmits event information to prog via the pipe.
- s6-uevent-listener, like prog, is a long-lived program.
When it receives a SIGTERM, it stops listening; it will
exit as soon as it has flushed its event queue to prog.
Options
- -v verbosity : be more or less verbose.
Default verbosity is 1. 0 will only print fatal error messages, 3 will
print warnings every time the netlink interface sends something
unexpected.
- -b kbufsz : try and reserve a kernel buffer of
kbufsz bytes for the netlink queue. Too large a buffer wastes kernel memory;
too small a buffer risks losing events. The default is 65536 (which is on
the large side).
Protocol
Notes
- s6-uevent-listener is a daemon; it should be run under a proper supervision system such
as s6.
- If you are running s6-uevent-listener, prog... should be the
only program handling uevents, which means that
/proc/sys/kernel/hotplug should be empty.
- If you want the serialization benefit of the netlink, but still
want to spawn a program such as busybox's
or toybox's mdev, use
s6-uevent-spawner mdev as
s6-uevent-listener's prog.