The runbg() function is a delayed execvp() that has double-forked to the
background (to not create zombies). It is useful for running commands
in the background for APIs that need to return a reply, e.g. a NETCONF
RPC to reboot the system.
Compared to the original in Infix, this version double forks to reparent
itself to PID 1 (init), closes all open files, including stdio.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
For filesystems without high-resolution time support, an usleep() is too short
to alter mtime. Though 1s is quite safe, sleep for 2s in case it gets awaken
right within that second.
The tree.h and queue.h include guards must remain so users don't
accidentally get their system queue.h included as well.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>