svn commit: r194262 - in head: include lib/libc/sys sys/compat/freebsd32 sys/kern tools/regression/file/closefrom

John Baldwin jhb at freebsd.org
Mon Jun 15 21:10:19 UTC 2009


On Monday 15 June 2009 5:02:18 pm Kostik Belousov wrote:
> On Mon, Jun 15, 2009 at 08:38:55PM +0000, John Baldwin wrote:
> > Author: jhb
> > Date: Mon Jun 15 20:38:55 2009
> > New Revision: 194262
> > URL: http://svn.freebsd.org/changeset/base/194262
> > 
> > Log:
> >   Note that this implementation of closefrom(2) does not make any effort 
to
> >   resolve userland races with open(2) in other threads.  As such, it is 
not
> >   multithread safe.
> ...
> > +	FILEDESC_SLOCK(fdp);
> > +	for (fd = uap->lowfd; fd < fdp->fd_nfiles; fd++) {
> > +		if (fdp->fd_ofiles[fd] != NULL) {
> > +			FILEDESC_SUNLOCK(fdp);
> > +			(void)kern_close(td, fd);
> > +			FILEDESC_SLOCK(fdp);
> > +		}
> > +	}
> > +	FILEDESC_SUNLOCK(fdp);
> 
> Just curious why this was not implemented in userspace ? Audit + fd_nfiles,
> perhaps ?
> 
> I am sorry, but somebody would ask this question anyway, so why not me ?

I will defer to Robert so he can expound on this. :)

-- 
John Baldwin


More information about the svn-src-head mailing list