Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Aug 2008 15:43:14 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Peter Jeremy <peterjeremy@optushome.com.au>
Cc:        cvs-src@freebsd.org, src-committers@freebsd.org, Ed Schouten <ed@freebsd.org>, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/dev/io iodev.c
Message-ID:  <200808091543.15299.jhb@freebsd.org>
In-Reply-To: <20080809001256.GL64458@server.vk2pj.dyndns.org>
References:  <200808081343.m78DhwYE068477@repoman.freebsd.org> <200808081226.32089.jhb@freebsd.org> <20080809001256.GL64458@server.vk2pj.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 08 August 2008 08:12:56 pm Peter Jeremy wrote:
> On 2008-Aug-08 12:26:31 -0400, John Baldwin <jhb@freebsd.org> wrote:
> >It should be setting D_TRACKCLOSE though so that close() reliably clears
> > the flag even in single-threaded processes.  You can still get odd
> > behavior if you explicitly open it twice in an app and then close one of
> > the two fd's. You will no longer have IO permission even though you still
> > have one fd open. However, if you do that I think you deserve what you
> > asked for. :)
>
> That behaviour may be legitimate:  Your code links with libraries foo and
> bar that each independently open /dev/io so they can frob different things
> in IO space.  libfoo needs ongoing access to device foo and so keeps its
> descriptor open.  libbar only needs once-off access to device bar and so
> closes /dev/io once it's finished its initialisation.  Libraries foo and
> bar are completely independent and shouldn't need to know anything about
> each other and your app shouldn't need to know that libraries it's using
> frob around in IO space.

Then it requires a per-thread (really per-process) counter.  However, 
D_TRACKCLOSE is still better than what is there now and will be needed for 
the counter case to have a chance of working.

-- 
John Baldwin



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