Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Oct 2004 09:50:55 -0500
From:      Ryan Sommers <ryans@gamersimpact.com>
To:        Carl J <carlj1752@hotmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: open() vs the lowest unused file descriptor
Message-ID:  <4171354F.9090400@gamersimpact.com>
In-Reply-To: <BAY15-F3OUIHNkjgJKV000007b3@hotmail.com>
References:  <BAY15-F3OUIHNkjgJKV000007b3@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Carl J wrote:

> Hi!
>
> Today I noticed that on Single Unix Specification V2,
> as well as on the Linux 2.4.26 machine I have here,
> that the open() call promises to return the lowest
> unused file descriptor when successful.
>
> I'm just wondering: does FreeBSD 4.x and 5.x promise
> that? If so, should we update the manpage
> to match SUSv2 more closely?
>
> Thank you!
>
> - Carl


4.x I'm pretty sure about 5.x I know does. This isn't a new thing. Since 
as far back as I can remember the UNIX semantics have been to return the 
lowest unused fd on an open(2) call. This has also been the subject of 
much discussion as finding the first free descriptor can cost a lot of 
processing power for applications that use large numbers of descriptors. 
FreeBSD uses a bitmap with hints I believe. All code would be in 
sys/kern_descrip.c.

-- 
Ryan Sommers
ryans@gamersimpact.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4171354F.9090400>