Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 2009 17:08:11 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r194262 - in head: include lib/libc/sys sys/compat/freebsd32 sys/kern tools/regression/file/closefrom
Message-ID:  <200906151708.11776.jhb@freebsd.org>
In-Reply-To: <20090615210218.GS23592@deviant.kiev.zoral.com.ua>
References:  <200906152038.n5FKctaR001026@svn.freebsd.org> <20090615210218.GS23592@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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