tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Library support for two-phase daemonization



On Tue, 28 Jan 2014, Andreas Gustafsson wrote:
I propose to do this by adding the two functions daemon2_fork() and
daemon2_detach() to libc.  A patch containing my proposed changes is
at:

  http://www.gson.org/netbsd/patches/daemon2-v9.patch

Please could you show how to implement daemon() in terms of daemon2_*.

Could the args be passed to daemon2_fork() instead of to
daemon2_detach(), to make it easier to convert code from using daemon()
to daemon2_*()?

If we are redesigning this interface, then perhaps we should go further, and provide a richer list of things to do in between the fork and the detach. Some possible things one might want to do are: setuid, chroot, chdir(somewhere other than "/"), anything that posix_spawn() can do.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index