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, Jan 28, 2014 at 07:56:31PM +0200, Andreas Gustafsson wrote:
> Comments?  Objections?

I don't like the approach. I would to just extend the existing daemon
interface slightly.

(1) daemon2() returns a filter descriptor. It is the responsibility of
the child to write '\0' to this fd and close it, once it is done with
initialisation.

(2) If the child writes a code other than '\0', it is interpreted as
error by the parent and used as exit status.

(3) A new argument provides the default exit code in case the child
terminates before writing the status byte.

Whether a timeout should be provided as fourth argument is a question I
can't answer right now.

Note that the existing daemon functionality can be obtained by just
closing the descriptor returned by daemon2.

Joerg


Home | Main Index | Thread Index | Old Index