s6-linux-utils
Software
skarnet.org
The s6-uevent-spawner program
s6-uevent-spawner listens to its standard input for
netlink-style events, and launches a helper program for every event,
similarly to what the hotplug interface does.
It is meant to be used together with
s6-uevent-listener.
Interface
s6-uevent-spawner [ -v verbosity ] [ -l linevar ] [ -t l:t:k ] prog...
- s6-uevent-spawner listens to its stdin for a series of strings
representing kernel uevents, as formatted by
s6-uevent-listener.
- For every event it reads, it spawns prog... with
the event variables added to the environment, just as if prog...
had been registered in /proc/sys/kernel/hotplug. However,
it reads the events sequentially, and waits for a prog instance
to finish before spawning another one.
- When s6-uevent-spawner receives EOF: if an instance of
prog is alive, it first waits for it to die. Then it exits
0.
Options
- -v verbosity : be more or less verbose.
Default verbosity is 1. 0 only prints fatal error messages. 3 is too much.
- -l linevar : make the event description
(i.e. the first string in the netlink message announcing the event)
available in prog under the environment variable linevar.
By default, this first string is ignored - it is not needed, all the
event information is already in the other variables.
- -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-uevent-spawner yells and exits 99.
Notes
- The prog... helper should be very short-lived,
even if you are not using the -t option. Since helpers are
spawned sequentially, slow helpers can make events queue up and fill up
buffers.