Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-29 Thread Dag-Erling Smørgrav
M. Warner Losh i...@bsdimp.com writes: + /* + * Close the PID file, and all other open descriptors. + * Inherit std{in,out,err} only. + */ + cfg.close_pidfile(); + ::closefrom(3); Actually, closefrom() is sufficient,

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-29 Thread M. Warner Losh
In message: 86r5jqdz9w@ds4.des.no Dag-Erling Smørgrav d...@des.no writes: : M. Warner Losh i...@bsdimp.com writes: : + /* : +* Close the PID file, and all other open descriptors. : +* Inherit std{in,out,err} only. : +*/ : +

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-29 Thread Dag-Erling Smørgrav
M. Warner Losh i...@bsdimp.com writes: I went ahead and used pidfile_close in this context because that's what's recommended in the man page. I know it is likely redundant, but I thought better safe than sorry... agreed... DES -- Dag-Erling Smørgrav - d...@des.no

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Dag-Erling Smørgrav
M. Warner Losh i...@bsdimp.com writes: Why not fix pidfile_open to not return a file handle when the PID doesn't match? It doesn't. If it can't lock the file, or if fstat(2) fails after it has locked the file, it returns NULL. DES -- Dag-Erling Smørgrav - d...@des.no

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Dag-Erling Smørgrav
M. Warner Losh i...@bsdimp.com writes: Maybe the real problem is that devd locks the file, then dies. The file remains locked, so the flopen is failing with EWOULDBLOCK. The lock is released when the process that holds it terminates. But I suspect the real real problem is the implicit

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Dag-Erling Smørgrav
Dag-Erling Smørgrav d...@des.no writes: M. Warner Losh i...@bsdimp.com writes: Maybe the real problem is that devd locks the file, then dies. The file remains locked, so the flopen is failing with EWOULDBLOCK. The lock is released when the process that holds it terminates. But I suspect

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Dag-Erling Smørgrav
Dag-Erling Smørgrav d...@des.no writes: - Under flock semantics (flock(2) locks), the lock is released when *all* file descriptors the process holds for that file is closed. are, even, and sorry for the horrid quoting. DES -- Dag-Erling Smørgrav - d...@des.no

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread M. Warner Losh
In message: 86mxuf7eli@ds4.des.no Dag-Erling Smørgrav d...@des.no writes: : M. Warner Losh i...@bsdimp.com writes: : Why not fix pidfile_open to not return a file handle when the PID : doesn't match? : : It doesn't. If it can't lock the file, or if fstat(2) fails after it : has

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread M. Warner Losh
In message: 86iq537egy@ds4.des.no Dag-Erling Smørgrav d...@des.no writes: : M. Warner Losh i...@bsdimp.com writes: : Maybe the real problem is that devd locks the file, then dies. The : file remains locked, so the flopen is failing with EWOULDBLOCK. : : The lock is released

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread M. Warner Losh
In message: aanlktiki223vbybdeqlua6fjcbbeqcqfujoimp5ho...@mail.gmail.com Garrett Cooper yanef...@gmail.com writes: : On Sun, Jun 27, 2010 at 3:08 PM, M. Warner Losh i...@bsdimp.com wrote: : In message: aanlktilnygnz7v6z6akeksquvomn8ylvo57gm1goi...@mail.gmail.com :            Garrett

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Dag-Erling Smørgrav
M. Warner Losh i...@bsdimp.com writes: Dag-Erling Smørgrav d...@des.no writes: M. Warner Losh i...@bsdimp.com writes: Maybe the real problem is that devd locks the file, then dies. The file remains locked, so the flopen is failing with EWOULDBLOCK. The lock is released when the process

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Garrett Cooper
2010/6/28 Dag-Erling Smørgrav d...@des.no: M. Warner Losh i...@bsdimp.com writes: Dag-Erling Smørgrav d...@des.no writes: M. Warner Losh i...@bsdimp.com writes: Maybe the real problem is that devd locks the file, then dies.  The file remains locked, so the flopen is failing with

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Garrett Cooper
On Sun, Jun 27, 2010 at 3:08 PM, M. Warner Losh i...@bsdimp.com wrote: In message: aanlktilnygnz7v6z6akeksquvomn8ylvo57gm1goi...@mail.gmail.com            Garrett Cooper yanef...@gmail.com writes: : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper yanef...@gmail.com wrote: : On Sat, Jun 26,

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread M. Warner Losh
In message: aanlktimpbazy2gu8fsly6wqdyzvg7c0id-vzeh3a3...@mail.gmail.com Garrett Cooper yanef...@gmail.com writes: : This patch is wrong.  The problems with it: : : (1) You don't need to unlink the pipe.  If you can't unlink it, then :    you won't remove the pid file. : : The

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Dag-Erling Smørgrav
Garrett Cooper yanef...@gmail.com writes: It leaves stray unused lockfiles in the directory: That's normal and harmless. DES -- Dag-Erling Smørgrav - d...@des.no ___ freebsd-current@freebsd.org mailing list

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Garrett Cooper
2010/6/28 Dag-Erling Smørgrav d...@des.no: Garrett Cooper yanef...@gmail.com writes: It leaves stray unused lockfiles in the directory: That's normal and harmless. Yeah.. it's just a bit messy :D. Thanks for the help! -Garrett ___

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Garrett Cooper
On Sat, Jun 26, 2010 at 10:50 PM, Doug Barton do...@freebsd.org wrote: On 06/26/10 13:29, Hans Petter Selasky wrote: Hi, Sometimes utilities that are started by devd require libraries outside /usr/lib. One example is the webcamd utility which is started by devd upon USB device insertion.

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-28 Thread Doug Barton
On Mon, 28 Jun 2010, Garrett Cooper wrote: On Sat, Jun 26, 2010 at 10:50 PM, Doug Barton do...@freebsd.org wrote: On 06/26/10 13:29, Hans Petter Selasky wrote: Hi, Sometimes utilities that are started by devd require libraries outside /usr/lib. One example is the webcamd utility which is

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-27 Thread M. Warner Losh
In message: aanlktilnygnz7v6z6akeksquvomn8ylvo57gm1goi...@mail.gmail.com Garrett Cooper yanef...@gmail.com writes: : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper yanef...@gmail.com wrote: : On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky hsela...@c2i.net wrote: : Hi, : :

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-27 Thread M. Warner Losh
In message: aanlktilnygnz7v6z6akeksquvomn8ylvo57gm1goi...@mail.gmail.com Garrett Cooper yanef...@gmail.com writes: : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper yanef...@gmail.com wrote: : On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky hsela...@c2i.net wrote: : Hi, : :

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-27 Thread Garrett Cooper
On Sun, Jun 27, 2010 at 3:08 PM, M. Warner Losh i...@bsdimp.com wrote: In message: aanlktilnygnz7v6z6akeksquvomn8ylvo57gm1goi...@mail.gmail.com            Garrett Cooper yanef...@gmail.com writes: : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper yanef...@gmail.com wrote: : On Sat, Jun 26,

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-27 Thread M. Warner Losh
In message: aanlktiki223vbybdeqlua6fjcbbeqcqfujoimp5ho...@mail.gmail.com Garrett Cooper yanef...@gmail.com writes: : On Sun, Jun 27, 2010 at 3:08 PM, M. Warner Losh i...@bsdimp.com wrote: : In message: aanlktilnygnz7v6z6akeksquvomn8ylvo57gm1goi...@mail.gmail.com :            Garrett

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-26 Thread Garrett Cooper
On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky hsela...@c2i.net wrote: Hi, Sometimes utilities that are started by devd require libraries outside /usr/lib. One example is the webcamd utility which is started by devd upon USB device insertion. What do you think about the following patch:

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-26 Thread Garrett Cooper
On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper yanef...@gmail.com wrote: On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky hsela...@c2i.net wrote: Hi, Sometimes utilities that are started by devd require libraries outside /usr/lib. One example is the webcamd utility which is started by

Re: Patch for rc.d/devd on FreeBSD 9-current

2010-06-26 Thread Doug Barton
On 06/26/10 13:29, Hans Petter Selasky wrote: Hi, Sometimes utilities that are started by devd require libraries outside /usr/lib. One example is the webcamd utility which is started by devd upon USB device insertion. What do you think about the following patch: --- devd