Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Feb 2012 14:26:29 -0800
From:      Jos Backus <jos@catnook.com>
To:        Pawel Jakub Dawidek <pjd@freebsd.org>
Cc:        src-committers@freebsd.org, Guy Helmer <ghelmer@palisadesystems.com>, svn-src-all@freebsd.org, Andrey Zonov <andrey@zonov.org>, Mikolaj Golub <trociny@freebsd.org>, svn-src-head@freebsd.org
Subject:   Re: svn commit: r230869 - head/usr.sbin/daemon
Message-ID:  <CAETOPp3=RZak-H2B4t1jaBQ1sTrOFGYKygzjt=kWnbZy-WQ%2BLA@mail.gmail.com>
In-Reply-To: <20120205214647.GI30033@garage.freebsd.pl>
References:  <201202011641.q11Gf0j6095461@svn.freebsd.org> <20120204074201.GA1694@garage.freebsd.pl> <4F2CEB1D.10607@zonov.org> <27A0A960-F767-4D2C-BF3E-31F73FBF4E28@palisadesystems.com> <86zkcy5ur9.fsf@kopusha.home.net> <20120205093938.GC30033@garage.freebsd.pl> <86lioh7yz5.fsf@kopusha.home.net> <20120205214647.GI30033@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Pawel,

On Feb 5, 2012 1:48 PM, "Pawel Jakub Dawidek" <pjd@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAETOPp3=RZak-H2B4t1jaBQ1sTrOFGYKygzjt=kWnbZy-WQ%2BLA>