Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jul 2007 14:41:19 +0200
From:      Joerg Sonnenberger <joerg@britannica.bec.de>
To:        freebsd-hackers@freebsd.org
Subject:   Re: add closefrom() call
Message-ID:  <20070706124119.GD427@britannica.bec.de>
In-Reply-To: <468E16E6.6030608@delphij.net>
References:  <de5dfb5a0707041727j3e3518f9l5a019717a9f90aa@mail.gmail.com> <20070705122650.GE1302@britannica.bec.de> <468E16E6.6030608@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 06, 2007 at 06:18:14PM +0800, LI Xin wrote:
>  - closefrom(-1) would be no-op on DragonFly, my version would close all
> open files (From my understanding of OpenSolaris's userland
> implementation, this is Solaris's behavior).

I think this is a bad idea as -1 is generally an invalid file
descriptor.

>  - my version closefrom(very_big_fd) would result in EBADF.  I am not
> very sure whether this is correct, but it does not hurt for applications
> that thinks closefrom() would return void.

I don't think this is a good idea either. One typical use is closefrom(3)
and returning an error because no such descriptors are open sounds very
wrong. It also just adds another special case as the loop handles this
already....

Joerg



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