Recent change to Xprint/attributes.c breaks build

Glynn Clements glynn at gclements.plus.com
Wed May 4 14:11:59 PDT 2005


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.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list