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.
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-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.
- -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
- -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).
- s6-uevent-listener is a daemon; it should be run under a proper supervision system such
- 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
- 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 is a consumer. This
setup has the advantage, among others, that you can restart the netlink
listener and the event handler separately.