s6-linux-utils
Software
skarnet.org
The s6-uevent-listener program
s6-uevent-listener listens to the netlink interface for uevents
(also called "hotplug" or "udev" events), and writes those uevents to
its standard output, using a simple format.
This program is deprecated, and will disappear in a
near future version of s6-linux-utils. It has been replaced with the
mdevd-netlink
program, from the mdevd
package.
Interface
s6-uevent-listener [ -v verbosity ] [ -b kbufsz ]
- s6-uevent-listener binds to the netlink interface and listens for
hotplug events, as the udev program does.
- It writes event information to its stdout. The output contains
null characters, so a terminal will not display them correctly. To
properly use s6-uevent-listener, it should be piped into a handler
program such as
s6-uevent-spawner.
or mdevd.
- s6-uevent-listener 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 stdout.
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.
- Examples of valid uses of s6-uevent-listener:
- s6-uevent-listener | s6-uevent-spawner mdev
- s6-uevent-listener | mdevd
- Those examples can be made safer by using a supervision system:
under s6 or
s6-rc, write a service
pipeline where s6-uevent-listener is a producer and
s6-uevent-spawner mdev or mdevd is a consumer. This
setup has the advantage, among others, that you can restart the netlink
listener and the event handler separately.