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

2012-02-12 Thread Mikolaj Golub
On Sat, 11 Feb 2012 16:16:16 +0400 Andrey Zonov wrote: AZ On 11.02.2012 14:35, Mikolaj Golub wrote: 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

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

2012-02-12 Thread Pawel Jakub Dawidek
On Sun, Feb 12, 2012 at 09:06:55PM +0200, Mikolaj Golub wrote: AZ Check return code from pidfile_write() function. I saw many times AZ when pid could not be written because of there is not enough free AZ space (but file was created). Unfortunately, I have no suggestions AZ how to handle

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

2012-02-12 Thread Pawel Jakub Dawidek
On Sat, Feb 11, 2012 at 12:35:27PM +0200, Mikolaj Golub wrote: 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 The patch looks good to me. I'd just fix style nit: please

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

2012-02-12 Thread Andrey Zonov
On 13.02.2012 0:02, Pawel Jakub Dawidek wrote: On Sun, Feb 12, 2012 at 09:06:55PM +0200, Mikolaj Golub wrote: AZ Check return code from pidfile_write() function. I saw many times AZ when pid could not be written because of there is not enough free AZ space (but file was created).

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

2012-02-12 Thread Jos Backus
On Sun, Feb 12, 2012 at 12:41 PM, Andrey Zonov and...@zonov.org wrote: On 13.02.2012 0:02, Pawel Jakub Dawidek wrote: On Sun, Feb 12, 2012 at 09:06:55PM +0200, Mikolaj Golub wrote:  AZ  Check return code from pidfile_write() function.  I saw many times  AZ  when pid could not be written

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

2012-02-12 Thread Dmitry Morozovsky
On Mon, 13 Feb 2012, Andrey Zonov wrote: [snip] Please don't. Even if you can't write the pidfile, you should run the service. The same as for pidfile_open() failure as documented in example. Feel free to warn about problem with writing to pidfile, but don't treat it as critial error.

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

2012-02-12 Thread Mikolaj Golub
On Sun, 12 Feb 2012 12:56:58 -0800 Jos Backus wrote: JB Right. So why not add a Unix socket listener to daemon(8) so the rc.d JB script can send commands over the socket instead of using the pidfile? JB This is what supervise/svc let you do today. JB I don't understand why this solution

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

2012-02-12 Thread Jos Backus
On Feb 12, 2012 1:32 PM, Mikolaj Golub troc...@freebsd.org wrote: On Sun, 12 Feb 2012 12:56:58 -0800 Jos Backus wrote: JB Right. So why not add a Unix socket listener to daemon(8) so the rc.d JB script can send commands over the socket instead of using the pidfile? JB This is what

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

2012-02-11 Thread Mikolaj Golub
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

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

2012-02-11 Thread Andrey Zonov
On 11.02.2012 14:35, Mikolaj Golub wrote: 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

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

2012-02-08 Thread Mikolaj Golub
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

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

2012-02-08 Thread Pawel Jakub Dawidek
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

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

2012-02-06 Thread Pawel Jakub Dawidek
On Mon, Feb 06, 2012 at 09:39:47AM +0200, Mikolaj Golub wrote: On Sun, 5 Feb 2012 22:46:48 +0100 Pawel Jakub Dawidek wrote: PJD On Sun, Feb 05, 2012 at 11:27:10PM +0200, Mikolaj Golub wrote: Ok, using hastd code as a reference :-) here is my implementation. PJD - I'd not pass

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

2012-02-06 Thread Guy Helmer
On Feb 5, 2012, at 3:39 AM, Pawel Jakub Dawidek wrote: On Sat, Feb 04, 2012 at 08:16:42PM +0200, Mikolaj Golub wrote: ref8-amd64:/home/trociny% uname -r 8.2-STABLE ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10

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

2012-02-06 Thread Pawel Jakub Dawidek
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

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

2012-02-06 Thread John Baldwin
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

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

2012-02-06 Thread Andrey Zonov
On 06.02.2012 19:25, John Baldwin wrote: 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

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

2012-02-06 Thread Mikolaj Golub
On Mon, 6 Feb 2012 09:27:06 +0100 Pawel Jakub Dawidek wrote: PJD For the patch itself. PJD You don't have to have two separate cases depending on request for PJD pidfile. You can specify NULL pfh to the pidfile functions. PJD Even in example from the manual page when pfh is NULL there is a

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

2012-02-06 Thread Guy Helmer
On Feb 6, 2012, at 3:46 PM, Mikolaj Golub wrote: On Mon, 6 Feb 2012 09:27:06 +0100 Pawel Jakub Dawidek wrote: PJD For the patch itself. PJD You don't have to have two separate cases depending on request for PJD pidfile. You can specify NULL pfh to the pidfile functions. PJD Even in

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

2012-02-06 Thread Pawel Jakub Dawidek
On Mon, Feb 06, 2012 at 11:46:24PM +0200, Mikolaj Golub wrote: On Mon, 6 Feb 2012 09:27:06 +0100 Pawel Jakub Dawidek wrote: PJD For the patch itself. PJD You don't have to have two separate cases depending on request for PJD pidfile. You can specify NULL pfh to the pidfile functions.

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

2012-02-05 Thread Pawel Jakub Dawidek
On Sat, Feb 04, 2012 at 08:16:42PM +0200, Mikolaj Golub wrote: ref8-amd64:/home/trociny% uname -r 8.2-STABLE ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 daemon: process already running, pid: 19799 kopusha:~% uname

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

2012-02-05 Thread Pawel Jakub Dawidek
On Sat, Feb 04, 2012 at 10:32:56AM -0600, Guy Helmer wrote: On Feb 4, 2012, at 1:42 AM, Pawel Jakub Dawidek wrote: On Wed, Feb 01, 2012 at 04:41:00PM +, Guy Helmer wrote: Author: ghelmer Date: Wed Feb 1 16:40:59 2012 New Revision: 230869 URL:

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

2012-02-05 Thread Doug Barton
On 02/05/2012 01:59, Pawel Jakub Dawidek wrote: I seem to miss positives of the other approach. Leaving stale PIDs in pidfile is something we should avoid at all costs, so recommending that in the manual page is not the best recommendation. Which is worse ... potentially stale pidfiles that

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

2012-02-05 Thread Pawel Jakub Dawidek
On Sun, Feb 05, 2012 at 04:46:53AM -0800, Doug Barton wrote: On 02/05/2012 01:59, Pawel Jakub Dawidek wrote: I seem to miss positives of the other approach. Leaving stale PIDs in pidfile is something we should avoid at all costs, so recommending that in the manual page is not the best

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

2012-02-05 Thread Mikolaj Golub
On Sun, 5 Feb 2012 10:39:38 +0100 Pawel Jakub Dawidek wrote: PJD On Sat, Feb 04, 2012 at 08:16:42PM +0200, Mikolaj Golub wrote: ref8-amd64:/home/trociny% uname -r 8.2-STABLE ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid

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

2012-02-05 Thread Pawel Jakub Dawidek
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

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

2012-02-05 Thread Jos Backus
Hi Pawel, On Feb 5, 2012 1:48 PM, Pawel Jakub Dawidek p...@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

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

2012-02-05 Thread Mikolaj Golub
On Sun, 5 Feb 2012 22:46:48 +0100 Pawel Jakub Dawidek wrote: PJD On Sun, Feb 05, 2012 at 11:27:10PM +0200, Mikolaj Golub wrote: Ok, using hastd code as a reference :-) here is my implementation. PJD - I'd not pass selected signals to the child. The parent can still be PJD killed with a

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

2012-02-04 Thread Andrey Zonov
On 04.02.2012 11:42, Pawel Jakub Dawidek wrote: On Wed, Feb 01, 2012 at 04:41:00PM +, Guy Helmer wrote: Author: ghelmer Date: Wed Feb 1 16:40:59 2012 New Revision: 230869 URL: http://svn.freebsd.org/changeset/base/230869 Log: Change the notes about the pidfile to include Doug's

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

2012-02-04 Thread Guy Helmer
On Feb 4, 2012, at 1:42 AM, Pawel Jakub Dawidek wrote: On Wed, Feb 01, 2012 at 04:41:00PM +, Guy Helmer wrote: Author: ghelmer Date: Wed Feb 1 16:40:59 2012 New Revision: 230869 URL: http://svn.freebsd.org/changeset/base/230869 Log: Change the notes about the pidfile to include

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

2012-02-04 Thread Guy Helmer
On Feb 4, 2012, at 2:23 AM, Andrey Zonov wrote: On 04.02.2012 11:42, Pawel Jakub Dawidek wrote: On Wed, Feb 01, 2012 at 04:41:00PM +, Guy Helmer wrote: Author: ghelmer Date: Wed Feb 1 16:40:59 2012 New Revision: 230869 URL: http://svn.freebsd.org/changeset/base/230869 Log:

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

2012-02-04 Thread Mikolaj Golub
On Sat, 4 Feb 2012 10:30:00 -0600 Guy Helmer wrote: GH On Feb 4, 2012, at 2:23 AM, Andrey Zonov wrote: On 04.02.2012 11:42, Pawel Jakub Dawidek wrote: On Wed, Feb 01, 2012 at 04:41:00PM +, Guy Helmer wrote: Author: ghelmer Date: Wed Feb 1 16:40:59 2012 New Revision: 230869

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

2012-02-03 Thread Pawel Jakub Dawidek
On Wed, Feb 01, 2012 at 04:41:00PM +, Guy Helmer wrote: Author: ghelmer Date: Wed Feb 1 16:40:59 2012 New Revision: 230869 URL: http://svn.freebsd.org/changeset/base/230869 Log: Change the notes about the pidfile to include Doug's preference for pre-creating the pidfile with

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

2012-02-01 Thread Guy Helmer
Author: ghelmer Date: Wed Feb 1 16:40:59 2012 New Revision: 230869 URL: http://svn.freebsd.org/changeset/base/230869 Log: Change the notes about the pidfile to include Doug's preference for pre-creating the pidfile with appropriate owner and permissions. Requested by dougb Modified:

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

2012-02-01 Thread Doug Barton
Thanks! Sorry I didn't get a chance to reply to your last message, totally buried lately. Doug On 02/01/2012 08:41, Guy Helmer wrote: Author: ghelmer Date: Wed Feb 1 16:40:59 2012 New Revision: 230869 URL: http://svn.freebsd.org/changeset/base/230869 Log: Change the notes about the