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

Pawel Jakub Dawidek pjd at FreeBSD.org
Wed Feb 8 09:07:16 UTC 2012


On Wed, Feb 08, 2012 at 10:32:41AM +0200, Mikolaj Golub wrote:
> 
> On Mon, 6 Feb 2012 23:17:43 +0100 Pawel Jakub Dawidek wrote:
> 
>  PJD> On Mon, Feb 06, 2012 at 11:46:24PM +0200, Mikolaj Golub wrote:
> 
>  >> Thanks. The updated version is attached.
> 
>  PJD> Looks good to me.
> 
> Thanks. But I still think that adding some signal handling is a good idea. I
> agree that there may be no sense in trying to handle many different signals,
> but handling SIGTERM (software termination signal :-) nicely looks like a good
> thing.

Ok:) In that case could you break you patch into one that only fixes the
problem we discussed and the other that implements new functionality?

> This would solve problems like stale pid files after shutdown or orphaned
> programs (again with stale pid files and a possibility to start another
> instance) due to a user mistakenly terminated the supervising daemons.
> 
> Also it is possible then to add "automatic restart" option, as Andrey has
> proposed.
> 
> Here is the patch that does it. It also change proctitle to make identifying a
> a supervisor with its charge.

I'd prefer to see more general solution to that problem, but I guess
this can't hurt. I've only one suggestion based on my experience.
Before you restart the program, wait for 1 second. This helps a lot when
you have misbehaving program or some misconfiguration that make the
process to exit immediately.

> A technical question concerning the patch :-). Does sombody know if
> sigwaitinfo() may be interrupted in my case and I should check for EINTR, as I
> do in the patch?

Calling sigwaitinfo() with second argument equal to NULL is equivalent
to calling sigwait(). The only difference is that sigwait() cannot be
interrupted by signal, thus never sets errno to EINTR. Why not to use
just that?

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20120208/89495eb8/attachment-0001.pgp


More information about the svn-src-all mailing list