Recent change to Xprint/attributes.c breaks build

Felix Schulte felix.schulte at gmail.com
Tue May 3 10:56:36 PDT 2005


On 5/3/05, Adam Jackson <ajax at nwnk.net> wrote:
> On Tuesday 03 May 2005 12:02, Felix Schulte wrote:
> > <On 5/3/05, Kean Johnston <kean at armory.com> wrote:
> > > A recent change to Xserver/Xprint/attributes.c breaks the build for
> > > me. Its due to a call to pread(). Is there no other way of dealing
> > > with the issue that caused this change?
> >
> > Can you ask in bug #790, pls?
> >
> > > I can imagine many older
> > > systems not having pread() available.
> >
> > pread() is POSIX AFAIK. Has SCO no way to read from files without changing
> > the file offset?
> 
> 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.
This emulation is not atomic and therefore will not work when a child
process created via fork() changes the file position. This is a
prefect candidate for a race-condition.

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



More information about the xorg mailing list