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

2010-06-29 Thread Dag-Erling Smørgrav
"M. Warner Losh" 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-29 Thread M. Warner Losh
In message: <86r5jqdz9w@ds4.des.no> Dag-Erling Smørgrav writes: : "M. Warner Losh" writes: : > + /* : > +* Close the PID file, and all other open descriptors. : > +* Inherit std{in,out,err} only. : > +*/ : > + cfg.close_pidfi

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

2010-06-29 Thread Dag-Erling Smørgrav
"M. Warner Losh" 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, since t

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

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 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. What d

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

2010-06-28 Thread Garrett Cooper
2010/6/28 Dag-Erling Smørgrav : > Garrett Cooper 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 ___ freebsd-current@freebsd.org mailing lis

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

2010-06-28 Thread Dag-Erling Smørgrav
Garrett Cooper 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 http://lists.freebsd.org/mailman/listinfo/freebsd-current To

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

2010-06-28 Thread M. Warner Losh
In message: Garrett Cooper 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 reason why my previous patch deleted `PIPE' file was because it's : not a true

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 wrote: > In message: >            Garrett Cooper writes: > : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper wrote: > : > On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky > wrote: > : >> Hi, > : >> > : >> Sometimes utilities that are started

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

2010-06-28 Thread Garrett Cooper
2010/6/28 Dag-Erling Smørgrav : > "M. Warner Losh" writes: >> Dag-Erling Smørgrav writes: >> > "M. Warner Losh" 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

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

2010-06-28 Thread Dag-Erling Smørgrav
"M. Warner Losh" writes: > Dag-Erling Smørgrav writes: > > "M. Warner Losh" 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.

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

2010-06-28 Thread M. Warner Losh
In message: Garrett Cooper writes: : On Sun, Jun 27, 2010 at 3:08 PM, M. Warner Losh wrote: : > In message: : >            Garrett Cooper writes: : > : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper wrote: : > : > On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky wrote: : >

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 writes: : "M. Warner Losh" 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 ho

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 writes: : "M. Warner Losh" 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

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

2010-06-28 Thread Dag-Erling Smørgrav
Dag-Erling Smørgrav 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 Dag-Erling Smørgrav
Dag-Erling Smørgrav writes: > "M. Warner Losh" 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 pr

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

2010-06-28 Thread Dag-Erling Smørgrav
"M. Warner Losh" 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 assumption that >

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

2010-06-28 Thread Dag-Erling Smørgrav
"M. Warner Losh" 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-27 Thread M. Warner Losh
In message: Garrett Cooper writes: : On Sun, Jun 27, 2010 at 3:08 PM, M. Warner Losh wrote: : > In message: : >            Garrett Cooper writes: : > : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper wrote: : > : > On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky wrote: : >

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 wrote: > In message: >            Garrett Cooper writes: > : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper wrote: > : > On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky > wrote: > : >> Hi, > : >> > : >> Sometimes utilities that are started

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

2010-06-27 Thread M. Warner Losh
In message: Garrett Cooper writes: : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper wrote: : > On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky wrote: : >> Hi, : >> : >> Sometimes utilities that are started by devd require libraries outside : >> /usr/lib. One example is the we

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

2010-06-27 Thread M. Warner Losh
In message: Garrett Cooper writes: : On Sat, Jun 26, 2010 at 1:45 PM, Garrett Cooper wrote: : > On Sat, Jun 26, 2010 at 1:29 PM, Hans Petter Selasky wrote: : >> Hi, : >> : >> Sometimes utilities that are started by devd require libraries outside : >> /usr/lib. One example is the we

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

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 wrote: > On Sat, Jun 26, 2010 at 1:29 PM, 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

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 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: > > --- dev

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

2010-06-26 Thread Hans Petter Selasky
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(revision 209463) +++ devd(local) @@ -4,7 +4,7 @@ #