s6-linux-utils
Software
skarnet.org
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
interface does.
Interface
s6-devd [ -q | -v ] [ -b kbufsz ] [ -l linevar ] [ -t l:t:k ] prog...
- s6-devd rewrites its command line into
s6-uevent-listener |
s6-uevent-spawner prog...,
dispatching its options to the appropriate programs; then it execs into
this new command line. It does nothing else: it's just a wrapper.
- The first executed program,
s6-uevent-listener,
will listen to the netlink and pass the events sequentially to
s6-uevent-spawner, which will
spawn a prog... helper for every event.
Options
- -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.
- -l linevar : the short description of the
event, given by the kernel as the first string in the netlink message,
will be made available to prog under the environment variable
named linevar.
- -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.
Notes
- s6-devd is a daemon; it should be run under a proper supervision system such
as s6. The real long-lived
process is named s6-uevent-listener;
ir runs with the same pid as s6-devd.
- 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 buffers
along the way.