svn commit: r230869 - head/usr.sbin/daemon
John Baldwin
jhb at freebsd.org
Mon Feb 6 16:09:10 UTC 2012
On Monday, February 06, 2012 9:43:39 am Pawel Jakub Dawidek wrote:
> On Mon, Feb 06, 2012 at 08:31:47AM -0600, Guy Helmer wrote:
> > If my understanding of flock(2) semantics is correct, with open(2)
O_CLOEXEC or fcntl(2) FD_CLOEXEC set on the pidfile, the closing of the
pidfile file descriptor during an exec will result in loss of the lock on the
pidfile regardless of whether daemon(8) hangs around to wait for the child
exit.
>
> My expectation is that as long as parent process holds pidfile
> descriptor open and locked, the pidfile should remain locked even after
> fork(2)/execve(2). Worth checking, though.
Yes, if the daemon process hung around that would work. Note that I think
you would need to do a double-fork for that to work though since users
expect daemon to return instantly and not need to be put in the background.
--
John Baldwin
More information about the svn-src-head
mailing list