Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jul 2002 16:19:51 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        current@FreeBSD.ORG, Alfred Perlstein <bright@mu.org>
Subject:   Re: Questions about kern_descrip.c
Message-ID:  <XFMail.20020718161933.jhb@FreeBSD.org>
In-Reply-To: <200207181909.g6IJ9hTq019460@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 18-Jul-2002 Matthew Dillon wrote:
> 
>:
>:* Matthew Dillon <dillon@apollo.backplane.com> [020718 11:40] wrote:
>:> 
>:>     fdalloc() does not reserve the descriptor number it
>:>     returns, it simply finds a free slot and says 'this
>:>     index is a free slot'.  Even in the latest -current,
>:>     fdalloc() releases the fdp lock when it goes to
>:>     MALLOC so the race appears to still be present.
>:
>:This is true.  I think one way to fix this is to preallocate
>:the 'struct file' you're going to put into the array and have
>:fdalloc() insert the created file instead of just finding a 
>:slot.  Problem is that it's a bunch of grunt work to do this.
>:
>:-- 
>:-Alfred Perlstein [alfred@freebsd.org]
>:'Instead of asking why a piece of software is using "1970s technology,"
> 
>     If you do this be careful in regards to open() and close() which
>     might place the descriptor in a transitory state.  You don't want
>     another thread picking the descriptor up while it is in that
>     state.

If you really wanted to do this you could just use '(struct file *)1'
or some other evil, but I really don't think it's necessary.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20020718161933.jhb>