svn commit: r230869 - head/usr.sbin/daemon

Jos Backus jos at catnook.com
Sun Feb 5 22:51:53 UTC 2012


Hi Pawel,

On Feb 5, 2012 1:48 PM, "Pawel Jakub Dawidek" <pjd at freebsd.org> wrote:
>
> On Sun, Feb 05, 2012 at 11:27:10PM +0200, Mikolaj Golub wrote:
> > Ok, using hastd code as a reference :-) here is my implementation.
>
> - I'd not pass selected signals to the child. The parent can still be
>  killed with a whole bunch of different signals that are not passed or
>  cannot be caught or the child process handle them gracefully.
>  Signals should be send to the PID from the pidfile anyway. If someone
>  is sending signals to the parent he has no right to expect well
>  behaviour from the parent.
>
> - Now that we handle the pidfile fully in the parent, I'd move dropping
>  provileges after fork(2) and pidfile_write(3). This way pidfiles will
>  always be created with root privileges and we can forget about all the
>  mess with pid directories, etc.
>
> - With the above you can wait for child to exit with simple wait(2).

If you are going to wait for the child anyway, you are doing almost
everything supervise does. All you now need is a Unix domain socket
interface so you can receive commands in daemon(1), and run daemon(1) at
boot. AND you can remove all the pidfile code :)

Jos


More information about the svn-src-head mailing list