[PATCH v2] pread_write.c: added cancellation for all architectures

Rich Felker dalias at aerifal.cx
Tue May 17 21:57:01 UTC 2011


On Tue, May 17, 2011 at 09:39:08PM +0200, Peter Mazinger wrote:
> > > Are you aware of any code that relies on _fake_ implementation? Maybe
> > > the functions have been simply added for completeness...
> > 
> > They exist to provide the broken/fake emulated implementation on
> > ancient kernels, not obscure archs. Whether pread/pwrite exist is
> > purely a function of the kernel version, not the arch.
> 
> Well, how would we go, if we would want to support more than linux?

Then you have a lot more to worry about than pread/pwrite...

> Other unixes would provide other syscalls, so in your interpretation
> we would have another "visible" function set. On the other side
> *libc tries to provide a set of functions that are available
> independently of the fact what kernel is running below it.

The idea of any current or new kernel lacking required functionality
that's been in POSIX for a long time, and which can't be emulated in
userspace, is rather far-fetched.

> At least this is how I understand it. POSIX is requiring functions,
> if we do not have them as syscalls available (as it is the case for
> most of required functions), we implement them in C (we might say,
> as long as kernel does not provide it, we need to implement a
> "fallback" version)

The "fallbacks" are worse than not having the functions at all, since
they lack the atomicity which is the whole point of these functions.
Any program using the emulated versions will be subject to dangerous
race conditions, unless it's using them frivilously where plain
lseek/read/write would do.

Rich


More information about the uClibc mailing list