Subject: Re: missing soclose() on sys_accept failure
To: Charles M. Hannum <>
From: Luke Mewburn <>
List: tech-net
Date: 02/22/2001 03:39:30
On Wed, Feb 21, 2001 at 08:10:02AM -0800, Jason R Thorpe wrote:
> On Tue, Feb 20, 2001 at 11:50:10PM -0800, Charles M. Hannum wrote:
>  > Shouldn't the FILE_UNUSE() also be moved down?  You don't want another
>  > thread trying to use the socket while it's still being accepted.
> FILE_UNUSE() prevents closef() from yanking the file out from under
> you while you're still using it.


(I've been learning about this fd locking stuff whilst porting
FreeBSD's kqueue stuff.  When the locking stuff isn't used correctly
you either end up tsleeping in "closef" with the wait channel being
the address of the refcount, or you panic. Fortunately, I haven't
had any panics yet :)