add closefrom() call
Ighighi Ighighi
ighighi at gmail.com
Thu Jul 5 00:56:48 UTC 2007
The closefrom() call, available in Solaris, is present in NetBSD since
version 3.0.
It is implemented with the F_CLOSEM fcntl() available since version 2.0.
These 2 fcntl would be cool to have in FreeBSD:
F_CLOSEM Close all file descriptors greater than or equal to fd.
F_MAXFD Return the maximum file descriptor number currently open by
the process.
I know that by using kern.file sysctl I could implement both, but it'd
be nice if the whole
closefrom() is done in kernel space. Another problem with using
kern.file is that
"struct xfile" may change...
By checking
http://fxr.watson.org/fxr/ident?v=NETBSD4;i=F_MAXFD
I see that it's fairly straightforward to add the F_MAXFD bit. For
the F_CLOSEM fcntl,
which call is the best to replace the fdrelease() used by NetBSD in
kern/kern_descrip.c ?
Can someone add these to FreeBSD ?
NetBSD's fcntl(2):
http://www.freebsd.org/cgi/man.cgi?query=fcntl&apropos=0&sektion=0&manpath=NetBSD+3.0&format=html
NetBSD's & Solaris' closefrom(3):
http://www.freebsd.org/cgi/man.cgi?query=closefrom&apropos=0&sektion=0&manpath=NetBSD+3.0&format=html
http://www.freebsd.org/cgi/man.cgi?query=closefrom&apropos=0&sektion=0&manpath=SunOS+5.9&format=html
Cheers,
Igh.
More information about the freebsd-hackers
mailing list