Recent change to Xprint/attributes.c breaks build

Felix Schulte felix.schulte at gmail.com
Tue May 3 10:57:49 PDT 2005


On 5/3/05, Adam Jackson <ajax at nwnk.net> wrote:
> On Tuesday 03 May 2005 12:59, Kean Johnston wrote:
> > > pread() is Unix98, not POSIX.
> > >
> > > It's perfectly possible to emulate pread:
> > >
> > > off_t saved = lseek(fd, 0, SEEK_CUR);
> > > lseek(fd, offset, SEEK_SET);
> > > read(fd, buf, count);
> > > lseek(fd, saved, SEEK_SET);
> > >
> > > Granted it's a few more system calls and it's not reentrant, but it
> > > works.  I would suggest that we add this to os-support/, since it's easy
> > > to emulate and part of a relatively well-adopted standard.
> >
> > And to make it re-entrant-ish you could add a few more calls around the
> > above code to lock byte 0 of the file while you're doing the pread()
> > to ensure that another process (not thread) doesn't come behind you
> > and change the offset.
> 
> I thought fd state was per-process and not global.
The fd state is shared between parent process and its children invoked
via fork().

> That'll still work of
> course, except on systems where we don't have posix locking semantics (mingw
> only I think).  But it's moot as long as the server is single-threaded.
> 
> > I certainly don't mind adding it to the os-support layer, its not
> > a big deal. Just want to make sure that the decision to make X.org
> > depend on a Unix98 environment was the intended effect. I think there
> > are still a fair number of Unix95 systems out there, but I may be
> > mistaken. My UNIX-world view has been a bit narrow in recent years.
> 
> http://www.opengroup.org/openbrand/register/
> 
> UnixWare, Irix, HP-UX 11, and Tru64 5.0 are Unix95 but not Unix98.  That's a
> fairly large set.
They all have pread().

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



More information about the xorg mailing list