Recent change to Xprint/attributes.c breaks build

Kean Johnston kean at armory.com
Tue May 3 09:59:43 PDT 2005


> 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 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.

Kean



More information about the xorg mailing list