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

Mikolaj Golub trociny at freebsd.org
Sat Feb 11 10:35:35 UTC 2012


On Wed, 8 Feb 2012 10:06:01 +0100 Pawel Jakub Dawidek wrote:

 PJD> 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.

 PJD> Ok:) In that case could you break you patch into one that only fixes the
 PJD> 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.

 PJD> I'd prefer to see more general solution to that problem, but I guess
 PJD> this can't hurt. I've only one suggestion based on my experience.
 PJD> Before you restart the program, wait for 1 second. This helps a lot when
 PJD> you have misbehaving program or some misconfiguration that make the
 PJD> 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?

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

Thank you. Here are the patches I would like to commit if there are no
objections or other suggestions:

http://people.freebsd.org/~trociny/daemon/daemon.spawn.1.patch
http://people.freebsd.org/~trociny/daemon/daemon.SIGTERM.1.patch
http://people.freebsd.org/~trociny/daemon/daemon.restart.1.patch

-- 
Mikolaj Golub


More information about the svn-src-all mailing list