Question regarding pwritev/preadv ports

Thu Sep 10 17:25:00 GMT 2015

Hi Mike,

Let me rephrase:
Given the set of all platforms libc supports,
I would like to know for which platforms the posix emulation is used?
And for bonus: Which of these do have __NR_pwritev? (So pwritev as syscall?)

For example:
If I am not mistaken, for some time the arm platform did have
the pwritev syscall, but still used the posix emulation.
For such a platform I want to use my own 'non-atomic' version.
I simple don't understand why there are 3 different implementations:
1: (off_t) ((((uint64_t) (val)) >> (sizeof (long) * 4)) >> (sizeof (long) * 4))
2: __LONG_LONG_PAIR (offset >> 31, offset));
3: __LONG_LONG_PAIR ((off_t) (offset >> 32), (off_t) (offset & 0xffffffff)));

I would really like to understand the 'why' of these...
Thank you,


At 16:35 2015-09-06, Mike Frysinger wrote:
>On 06 Sep 2015 12:03, Ben wrote:
> > I was wondering if there is any way for an application to 'know'
> > which implementation is used.
>not really, by design
> > The specific reason is: I want to override the posix implementation
> > with a non-atomic one.
> > (So just iterating over the vector until all is written.)
>just define & export the symbol then in a shared library and link or
>LD_PRELOAD it to interpose your version of the symbol
> > Furthermore, looking at the platform specific implementations,
> > they need to have the offset split into high and low value, I get that.
>i wouldn't worry about trying to call the kernel directly.  use dlopen
>and dlsym to get the symbol of the real pwritev from and call
>that one at a time on a single iovec element.

More information about the Libc-help mailing list