[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Library support for two-phase daemonization
On Sunday, at 17:51, Andreas Gustafsson wrote:
| > The API could be something like:
| > - daemon_fork()
| > - daemon_detach()
| > - daemon_spawn(): basically a posix_spawn() with the additional signal
| > notification pattern.
| I'm afraid I still don't see why this is needed. Is there currently
| code in NetBSD using this pattern? What advantages does it offer over
| traditional daemonization?
I think this is needed as soon as you want to spawn a process, via
posix_spawn() or fork()/exec(), and you want to be notified of the proper
startup/initialization of the process. This is slightly different from
daemonizing. When daemonizing, the parent and child run the same code (so you
control both "sides" and it's easier to communicate).
The libc/kernel offer no standard way of doing this, while there is for
instance the standard SIGCHLD and wait(2) for joining a dead child. So I felt
there was a potential for filling this gap and propose a clean pattern for
that. But maybe not :)
| Also, I'm specifically not trying to redesign or replace the existing
| daemonization API, but just to provide the minimum functionality
| needed to fix race conditions in existing NetBSD daemons. If you
| believe that can be better achieved with signals than with pipes, I'm
| interested in hearing your arguments, but I'm not really interested in
| solving any unrelated problems.
Yes. The problem I am raising is definitely not NetBSD specific at all :)
Main Index |
Thread Index |