Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jul 2007 10:34:09 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Julian Elischer <julian@elischer.org>
Subject:   Re: add closefrom() call
Message-ID:  <200707171034.09619.jhb@freebsd.org>
In-Reply-To: <469BB821.1010507@elischer.org>
References:  <de5dfb5a0707041727j3e3518f9l5a019717a9f90aa@mail.gmail.com> <20070716113425.GC65937@turion.vk2pj.dyndns.org> <469BB821.1010507@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 16 July 2007 02:25:37 pm Julian Elischer wrote:
> Peter Jeremy wrote:
> > On 2007-Jul-15 16:51:38 -0700, Julian Elischer <julian@elischer.org> 
wrote:
> >>> void
> >>> closefrom(int lowfd)
> >>> {
> >>> 	fcntl(lowfd, F_CLOSEM, NULL);
> >>> }
> >> what on earth would that achieve?
> >> (as opposed to just a simple syscall)
> > 
> > The only benefit I can think of is minimising the number of syscalls.
> > Is there any other benefit?
> > 
> 
> I don't think so.. it's less efficient, and harder to do..
> syscalls are not in short supply.

Actually, adding a new fcntl is about the same as adding a new system call 
except that you don't have to generate tables, etc. (so it might actually be 
simpler).  I'm not sure it's such a bad idea to just have a fcntl to get the 
max open fd and do the loop in userland so you get better auditing of the 
individual close() operations.

-- 
John Baldwin



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