The s6-devd program
s6-devd listens to the netlink interface for udev events, and
launches a helper program for every event, similarly to what the hotplug
s6-devd [ -q | -v ] [ -b kbufsz ] [ -t l:t:k ] prog...
- s6-devd binds to the netlink interface and listens for
hotplug events, as the udev program does.
- For every event it receives, it spawns prog... with
the event variables added to the environment, just as if prog...
had been registered in /proc/sys/kernel/hotplug.
- However, unlike the kernel, s6-devd spawns the prog... helpers
sequentially: it waits for an instance to finish before spawning another one.
- s6-devd is a long-lived program; it exits 0 when it receives a
SIGTERM. If a helper program is alive at that time, s6-devd waits for it to die
- -q : be more quiet.
- -v : be more verbose.
- -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.
- -t l:t:k : If l, t or k is
specified, they specify timeouts; by default, they are infinite.
If prog... is still alive after l milliseconds, s6-devd sends
it a SIGTERM. Then, if prog... is still alive after t more
milliseconds, s6-devd sends it a SIGKILL. Then, if prog... is still
alive after k more milliseconds, s6-devd yells and exits 99.
- s6-devd is a daemon; it should be run under a proper supervision system such
as s6. (That is why it does not
fork and logs to stderr.)
- The prog... helper, on the other hand, should be very short-lived,
even if you are not using the -t option to s6-devd. Since helpers are
spawned sequentially, slow helpers can make events queue up and fill the netlink
- If you are using busybox and want a
minimal udev-style dynamic /dev
handling, /sbin/mdev is a suitable prog... helper.
- The point of s6-devd is that it runs the helpers sequentially, so it solves
the race condition that appears when helpers are run via the hotplug interface.
When s6-devd is used, /proc/sys/kernel/hotplug should be empty.