Recent change to Xprint/attributes.c breaks build

Felix Schulte felix.schulte at gmail.com
Wed May 4 14:57:42 PDT 2005


On 5/4/05, Kirby C. Bohling <kbohling at birddog.com> wrote:
> On Wed, May 04, 2005 at 10:11:59PM +0100, Glynn Clements wrote:
> >
> > Felix Schulte wrote:
> >
> > > > > I thought fd state was per-process and not global.
> > > >
> > > > No; if a descriptor is duplicated, either explicitly by dup() etc or
> > > > implicitly by fork(), all copies share the same offset.
> > > >
> > > > The only way to get multiple descriptors for a given file which don't
> > > > share offsets is to open() the file multiple times.
> > >
> > > Does POSIX provide a variant of open() which takes a fd as argument?
> >
> > No.
> >
> > On Linux, you can open /proc/self/fd/<n>, but I don't recall whether
> > that's the same as a "real" open (i.e. gives you a new descriptor with
> > its own offset) or if it just duplicates the descriptor.
> 
> man fdopen() claims that fdopen is "POSIX.1", and that's probably a
> great deal more portable then /proc/self/fd/<n>  It does exactly
> what Felix wants.
fdopen() takes the file descriptor and wraps it in a FILE structure.
The race condition will not go away.

-- 
      _        Felix Schulte
    _|_|_     mailto:felix.schulte at gmail.com
    (0 0)        
ooO--(_)--Ooo



More information about the xorg mailing list