[v3,2/2] posix: Implement preadv2 and pwritev2
Commit Message
Change from previous version:
* Add unsupported flag check for Linux implementation.
* Unsupported/invalid flags now return EOPNOTSUPP instead of
EINVAL.
* Add comment about preadv2 and pwritev2 support on kernel-features.h.
* Add NEWS entry.
* Fix typo in documentation.
--
This patch adds support of preadv2 and pwritev2 which are similar to
preadv/pwritev but adds an extra flag argument. As for preadv/pwritev
both interfaces are added a non-standard standard GNU API.
On default 'posix' implementation trying to emulate the Linux supported
flags is troublesome:
* We can not temporary change the file state of the O_DSYNC and O_SYNC
flags to emulate RWF_{D}SYNC (attempts to change the state of using
fcntl are silently ignored).
* IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
semantic not provided by any other flag (O_NONBLOCK for instance).
So default sysdeps/posix implementations fails with EINVAL for any non
supported flag (which are none currently) calls generic preadv/pwritev.
Basically, it supports only preadv2 called as preadv (with flags sets
to 0).
The Linux one uses the preadv2/pwritev2 syscall if defined, otherwise it
call preadv/writev. Instead of using the previous __ASSUME_* to
unconditionally issue the syscall (and avoid building the fallback routine),
it call pread/write if the preadv2/pwritev2 syscalls fails. The idea
is just avoid adding another __ASSUME_* and checking each architecture
on every kernel bump and simplify code conditionals.
Checked on x86_64-linux-gnu and on i686-linux-gnu and a check with
run-built-tests=no on aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips{64,64n32}-linux-gnu,
nios2-linux-gnu, powerpc{64,64le}-linux-gnu, s390{x}-linux-gnu,
sparc{64,v9}-linux-gnu, tile{gx,pro}-linux-gnu, and sh4-linux-gnu (all using
gcc 6.3).
* NEWS: Add note about pwritev2 and preadv2 inclusion.
* misc/Makefile (routines): Add preadv2, preadv64v2, pwritev2, and
pwritev64v2.
(tests): Add tst-preadvwritev2 and tst-preadvwritev64v2.
* misc/Versions (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, and
pwritev64v2.
* misc/preadv2.c: New file.
* misc/preadv64v2.c: Likewise.
* misc/pwritev2.c: Likewise.
* misc/pwritev64v2.c: Likewise.
* misc/tst-preadvwritev2.c: Likewise.
* misc/tst-preadvwritev64v2.c: Likewise.
* manual/llio.texi: Add preadv2 and pwritev2 documentation.
* misc/sys/uio.h [__USE_GNU && !__USE_FILE_OFFSET64] (preadv2): New
prototype.
[__USE_GNU && !__USE_FILE_OFFSET64] (pwritev2): Likewise.
[__USE_GNU && __USE_FILE_OFFSET64] (preadv64v2): Likewise.
[__USE_GNU && __USE_FILE_OFFSET64] (pwritev64v2): Likewise.
* misc/tst-preadvwritev-common.c (PREADV): Define if not defined.
(PWRITEV): Likewise.
(do_test_with_offset): Use PREADV and PWRITEV macros and check for
ENOSYS.
* nptl/tst-cancel4.c (tf_pwritev2): New test.
(tf_preadv2): Likewise.
(tf_fsync): Add tf_pwritev2 and tf_preadv2.
* sysdeps/posix/preadv2.c: Likewise.
* sysdeps/posix/preadv64v2.c: Likewise.
* sysdeps/posix/pwritev2.c: Likewise.
* sysdeps/posix/pwritev64v2.c: Likewise.
* sysdeps/unix/sysv/linux/kernel-features.h: Add comment for syscall
support in kernel.
* sysdeps/unix/sysv/linux/preadv2.c: Likewise.
* sysdeps/unix/sysv/linux/preadv64v2.c: Likewise.
* sysdeps/unix/sysv/linux/pwritev2.c: Likewise.
* sysdeps/unix/sysv/linux/pwritev64v2.c: Likewise.
* sysdeps/unix/sysv/linux/preadv.c (preadv): Add libc_hidden_def.
* sysdeps/unix/sysv/linux/preadv64.c (preadv64): Likewise.
* sysdeps/unix/sysv/linux/pwritev.c (pwritev): Likewise.
* sysdeps/unix/sysv/linux/pwritev64.c (pwritev64): Likewise.
* sysdeps/unix/sysv/linux/bits/uio.h: Add supported preadv2/pwritev2
support flags on Linux.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.26): Add
preadv2, preadv64v2, pwritev2, pwritev64v2.
* sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
(GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
(GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
(GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.26): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/sysv/linux/tile/tilegx/tilegx32/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/sysv/linux/tile/tilegx/tilegx64/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.26):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.26):
Likewise.
---
ChangeLog | 91 +++++++++++++++++
NEWS | 7 ++
include/sys/uio.h | 6 ++
manual/llio.texi | 109 +++++++++++++++++++++
misc/Makefile | 5 +-
misc/Versions | 3 +
misc/preadv2.c | 30 ++++++
misc/preadv64v2.c | 30 ++++++
misc/pwritev2.c | 30 ++++++
misc/pwritev64v2.c | 30 ++++++
misc/sys/uio.h | 41 ++++++++
misc/tst-preadvwritev-common.c | 19 +++-
misc/tst-preadvwritev2.c | 31 ++++++
misc/tst-preadvwritev64v2.c | 33 +++++++
nptl/tst-cancel4.c | 71 ++++++++++++++
sysdeps/posix/preadv2.c | 38 +++++++
sysdeps/posix/preadv64v2.c | 37 +++++++
sysdeps/posix/pwritev2.c | 38 +++++++
sysdeps/posix/pwritev64v2.c | 38 +++++++
sysdeps/unix/sysv/linux/aarch64/libc.abilist | 5 +
sysdeps/unix/sysv/linux/alpha/libc.abilist | 5 +
sysdeps/unix/sysv/linux/arm/libc.abilist | 5 +
sysdeps/unix/sysv/linux/bits/uio.h | 6 ++
sysdeps/unix/sysv/linux/hppa/libc.abilist | 5 +
sysdeps/unix/sysv/linux/i386/libc.abilist | 5 +
sysdeps/unix/sysv/linux/ia64/libc.abilist | 5 +
sysdeps/unix/sysv/linux/kernel-features.h | 5 +
sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist | 5 +
sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist | 5 +
sysdeps/unix/sysv/linux/microblaze/libc.abilist | 5 +
.../unix/sysv/linux/mips/mips32/fpu/libc.abilist | 5 +
.../unix/sysv/linux/mips/mips32/nofpu/libc.abilist | 5 +
.../unix/sysv/linux/mips/mips64/n32/libc.abilist | 5 +
.../unix/sysv/linux/mips/mips64/n64/libc.abilist | 5 +
sysdeps/unix/sysv/linux/nios2/libc.abilist | 5 +
.../sysv/linux/powerpc/powerpc32/fpu/libc.abilist | 5 +
.../linux/powerpc/powerpc32/nofpu/libc.abilist | 5 +
.../sysv/linux/powerpc/powerpc64/libc-le.abilist | 5 +
.../unix/sysv/linux/powerpc/powerpc64/libc.abilist | 5 +
sysdeps/unix/sysv/linux/preadv.c | 2 +
sysdeps/unix/sysv/linux/preadv2.c | 55 +++++++++++
sysdeps/unix/sysv/linux/preadv64.c | 2 +
sysdeps/unix/sysv/linux/preadv64v2.c | 55 +++++++++++
sysdeps/unix/sysv/linux/pwrite64.c | 1 +
sysdeps/unix/sysv/linux/pwritev.c | 2 +
sysdeps/unix/sysv/linux/pwritev2.c | 51 ++++++++++
sysdeps/unix/sysv/linux/pwritev64.c | 2 +
sysdeps/unix/sysv/linux/pwritev64v2.c | 55 +++++++++++
sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist | 5 +
sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist | 5 +
sysdeps/unix/sysv/linux/sh/libc.abilist | 5 +
sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist | 5 +
sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist | 5 +
.../sysv/linux/tile/tilegx/tilegx32/libc.abilist | 5 +
.../sysv/linux/tile/tilegx/tilegx64/libc.abilist | 5 +
sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist | 5 +
sysdeps/unix/sysv/linux/x86_64/64/libc.abilist | 5 +
sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist | 5 +
58 files changed, 1058 insertions(+), 5 deletions(-)
create mode 100644 misc/preadv2.c
create mode 100644 misc/preadv64v2.c
create mode 100644 misc/pwritev2.c
create mode 100644 misc/pwritev64v2.c
create mode 100644 misc/tst-preadvwritev2.c
create mode 100644 misc/tst-preadvwritev64v2.c
create mode 100644 sysdeps/posix/preadv2.c
create mode 100644 sysdeps/posix/preadv64v2.c
create mode 100644 sysdeps/posix/pwritev2.c
create mode 100644 sysdeps/posix/pwritev64v2.c
create mode 100644 sysdeps/unix/sysv/linux/preadv2.c
create mode 100644 sysdeps/unix/sysv/linux/preadv64v2.c
create mode 100644 sysdeps/unix/sysv/linux/pwritev2.c
create mode 100644 sysdeps/unix/sysv/linux/pwritev64v2.c
Comments
Ping.
On 04/05/2017 09:43, Adhemerval Zanella wrote:
> Change from previous version:
>
> * Add unsupported flag check for Linux implementation.
>
> * Unsupported/invalid flags now return EOPNOTSUPP instead of
> EINVAL.
>
> * Add comment about preadv2 and pwritev2 support on kernel-features.h.
>
> * Add NEWS entry.
>
> * Fix typo in documentation.
>
> --
>
> This patch adds support of preadv2 and pwritev2 which are similar to
> preadv/pwritev but adds an extra flag argument. As for preadv/pwritev
> both interfaces are added a non-standard standard GNU API.
>
> On default 'posix' implementation trying to emulate the Linux supported
> flags is troublesome:
>
> * We can not temporary change the file state of the O_DSYNC and O_SYNC
> flags to emulate RWF_{D}SYNC (attempts to change the state of using
> fcntl are silently ignored).
>
> * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
> semantic not provided by any other flag (O_NONBLOCK for instance).
>
> So default sysdeps/posix implementations fails with EINVAL for any non
> supported flag (which are none currently) calls generic preadv/pwritev.
> Basically, it supports only preadv2 called as preadv (with flags sets
> to 0).
>
> The Linux one uses the preadv2/pwritev2 syscall if defined, otherwise it
> call preadv/writev. Instead of using the previous __ASSUME_* to
> unconditionally issue the syscall (and avoid building the fallback routine),
> it call pread/write if the preadv2/pwritev2 syscalls fails. The idea
> is just avoid adding another __ASSUME_* and checking each architecture
> on every kernel bump and simplify code conditionals.
>
> Checked on x86_64-linux-gnu and on i686-linux-gnu and a check with
> run-built-tests=no on aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
> ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips{64,64n32}-linux-gnu,
> nios2-linux-gnu, powerpc{64,64le}-linux-gnu, s390{x}-linux-gnu,
> sparc{64,v9}-linux-gnu, tile{gx,pro}-linux-gnu, and sh4-linux-gnu (all using
> gcc 6.3).
>
> * NEWS: Add note about pwritev2 and preadv2 inclusion.
> * misc/Makefile (routines): Add preadv2, preadv64v2, pwritev2, and
> pwritev64v2.
> (tests): Add tst-preadvwritev2 and tst-preadvwritev64v2.
> * misc/Versions (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, and
> pwritev64v2.
> * misc/preadv2.c: New file.
> * misc/preadv64v2.c: Likewise.
> * misc/pwritev2.c: Likewise.
> * misc/pwritev64v2.c: Likewise.
> * misc/tst-preadvwritev2.c: Likewise.
> * misc/tst-preadvwritev64v2.c: Likewise.
> * manual/llio.texi: Add preadv2 and pwritev2 documentation.
> * misc/sys/uio.h [__USE_GNU && !__USE_FILE_OFFSET64] (preadv2): New
> prototype.
> [__USE_GNU && !__USE_FILE_OFFSET64] (pwritev2): Likewise.
> [__USE_GNU && __USE_FILE_OFFSET64] (preadv64v2): Likewise.
> [__USE_GNU && __USE_FILE_OFFSET64] (pwritev64v2): Likewise.
> * misc/tst-preadvwritev-common.c (PREADV): Define if not defined.
> (PWRITEV): Likewise.
> (do_test_with_offset): Use PREADV and PWRITEV macros and check for
> ENOSYS.
> * nptl/tst-cancel4.c (tf_pwritev2): New test.
> (tf_preadv2): Likewise.
> (tf_fsync): Add tf_pwritev2 and tf_preadv2.
> * sysdeps/posix/preadv2.c: Likewise.
> * sysdeps/posix/preadv64v2.c: Likewise.
> * sysdeps/posix/pwritev2.c: Likewise.
> * sysdeps/posix/pwritev64v2.c: Likewise.
> * sysdeps/unix/sysv/linux/kernel-features.h: Add comment for syscall
> support in kernel.
> * sysdeps/unix/sysv/linux/preadv2.c: Likewise.
> * sysdeps/unix/sysv/linux/preadv64v2.c: Likewise.
> * sysdeps/unix/sysv/linux/pwritev2.c: Likewise.
> * sysdeps/unix/sysv/linux/pwritev64v2.c: Likewise.
> * sysdeps/unix/sysv/linux/preadv.c (preadv): Add libc_hidden_def.
> * sysdeps/unix/sysv/linux/preadv64.c (preadv64): Likewise.
> * sysdeps/unix/sysv/linux/pwritev.c (pwritev): Likewise.
> * sysdeps/unix/sysv/linux/pwritev64.c (pwritev64): Likewise.
> * sysdeps/unix/sysv/linux/bits/uio.h: Add supported preadv2/pwritev2
> support flags on Linux.
> * sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.26): Add
> preadv2, preadv64v2, pwritev2, pwritev64v2.
> * sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
> (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.26): Likewise.
> * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/sysv/linux/tile/tilegx/tilegx32/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/sysv/linux/tile/tilegx/tilegx64/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.26):
> Likewise.
> * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.26):
> Likewise.
> ---
> ChangeLog | 91 +++++++++++++++++
> NEWS | 7 ++
> include/sys/uio.h | 6 ++
> manual/llio.texi | 109 +++++++++++++++++++++
> misc/Makefile | 5 +-
> misc/Versions | 3 +
> misc/preadv2.c | 30 ++++++
> misc/preadv64v2.c | 30 ++++++
> misc/pwritev2.c | 30 ++++++
> misc/pwritev64v2.c | 30 ++++++
> misc/sys/uio.h | 41 ++++++++
> misc/tst-preadvwritev-common.c | 19 +++-
> misc/tst-preadvwritev2.c | 31 ++++++
> misc/tst-preadvwritev64v2.c | 33 +++++++
> nptl/tst-cancel4.c | 71 ++++++++++++++
> sysdeps/posix/preadv2.c | 38 +++++++
> sysdeps/posix/preadv64v2.c | 37 +++++++
> sysdeps/posix/pwritev2.c | 38 +++++++
> sysdeps/posix/pwritev64v2.c | 38 +++++++
> sysdeps/unix/sysv/linux/aarch64/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/alpha/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/arm/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/bits/uio.h | 6 ++
> sysdeps/unix/sysv/linux/hppa/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/i386/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/ia64/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/kernel-features.h | 5 +
> sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/microblaze/libc.abilist | 5 +
> .../unix/sysv/linux/mips/mips32/fpu/libc.abilist | 5 +
> .../unix/sysv/linux/mips/mips32/nofpu/libc.abilist | 5 +
> .../unix/sysv/linux/mips/mips64/n32/libc.abilist | 5 +
> .../unix/sysv/linux/mips/mips64/n64/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/nios2/libc.abilist | 5 +
> .../sysv/linux/powerpc/powerpc32/fpu/libc.abilist | 5 +
> .../linux/powerpc/powerpc32/nofpu/libc.abilist | 5 +
> .../sysv/linux/powerpc/powerpc64/libc-le.abilist | 5 +
> .../unix/sysv/linux/powerpc/powerpc64/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/preadv.c | 2 +
> sysdeps/unix/sysv/linux/preadv2.c | 55 +++++++++++
> sysdeps/unix/sysv/linux/preadv64.c | 2 +
> sysdeps/unix/sysv/linux/preadv64v2.c | 55 +++++++++++
> sysdeps/unix/sysv/linux/pwrite64.c | 1 +
> sysdeps/unix/sysv/linux/pwritev.c | 2 +
> sysdeps/unix/sysv/linux/pwritev2.c | 51 ++++++++++
> sysdeps/unix/sysv/linux/pwritev64.c | 2 +
> sysdeps/unix/sysv/linux/pwritev64v2.c | 55 +++++++++++
> sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/sh/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist | 5 +
> .../sysv/linux/tile/tilegx/tilegx32/libc.abilist | 5 +
> .../sysv/linux/tile/tilegx/tilegx64/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/x86_64/64/libc.abilist | 5 +
> sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist | 5 +
> 58 files changed, 1058 insertions(+), 5 deletions(-)
> create mode 100644 misc/preadv2.c
> create mode 100644 misc/preadv64v2.c
> create mode 100644 misc/pwritev2.c
> create mode 100644 misc/pwritev64v2.c
> create mode 100644 misc/tst-preadvwritev2.c
> create mode 100644 misc/tst-preadvwritev64v2.c
> create mode 100644 sysdeps/posix/preadv2.c
> create mode 100644 sysdeps/posix/preadv64v2.c
> create mode 100644 sysdeps/posix/pwritev2.c
> create mode 100644 sysdeps/posix/pwritev64v2.c
> create mode 100644 sysdeps/unix/sysv/linux/preadv2.c
> create mode 100644 sysdeps/unix/sysv/linux/preadv64v2.c
> create mode 100644 sysdeps/unix/sysv/linux/pwritev2.c
> create mode 100644 sysdeps/unix/sysv/linux/pwritev64v2.c
>
> diff --git a/NEWS b/NEWS
> index 5558ca3..afad4b1 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -57,6 +57,13 @@ Version 2.26
> be added on next major revision of POSIX, so current support is enabled
> with _GNU_SOURCE.
>
> +* New preadv2 and pwritev2 are added to libc. They are Linux extensions to
> + preadv and pwritev with an additional flag argument where it is possible
> + to set high priority or use O_DSYNC or O_SYNC for an specific IO operation.
> + For complete support it requires Linux kernel version 4.6, otherwise a
> + compat implementation will be used (which refuses all flags and routes it
> + to preadv or pwritev).
> +
> Security related changes:
>
> * The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes,
> diff --git a/include/sys/uio.h b/include/sys/uio.h
> index f44ce18..20860bf 100644
> --- a/include/sys/uio.h
> +++ b/include/sys/uio.h
> @@ -7,5 +7,11 @@ extern ssize_t __readv (int __fd, const struct iovec *__iovec,
> int __count);
> extern ssize_t __writev (int __fd, const struct iovec *__iovec,
> int __count);
> +
> +/* Used for p{read,write}{v64}v2 implementation. */
> +libc_hidden_proto (preadv)
> +libc_hidden_proto (preadv64)
> +libc_hidden_proto (pwritev)
> +libc_hidden_proto (pwritev64)
> #endif
> #endif
> diff --git a/manual/llio.texi b/manual/llio.texi
> index dae3754..404a966 100644
> --- a/manual/llio.texi
> +++ b/manual/llio.texi
> @@ -756,6 +756,115 @@ When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
> @code{pwritev} and so transparently replaces the 32 bit interface.
> @end deftypefun
>
> +@comment sys/uio.h
> +@comment GNU
> +@deftypefun ssize_t preadv2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}, int @var{flags})
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
> +@c is also MT-Safe since it calls preadv.
> +
> +This function is similar to the @code{preadv} function, with the difference
> +it adds an extra @var{flags} parameter of type @code{int}. The supported
> +@var{flags} are dependent of the underlying system. For Linux it supports:
> +
> +@vtable @code
> +@item RWF_HIPRI
> +High priority request. This adds a flag that tells the file system that
> +this is a high priority request for which it is worth to poll the hardware.
> +The flag is purely advisory and can be ignored if not supported. The
> +@var{fd} must be opened using @code{O_DIRECT}.
> +
> +@item RWF_DSYNC
> +Per-IO synchronization as if the file was opened with @code{O_DSYNC} flag.
> +
> +@item RWF_SYNC
> +Per-IO synchronization as if the file was opened with @code{O_SYNC} flag.
> +@end vtable
> +
> +When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
> +@code{preadv2} function is in fact @code{preadv64v2} and the type
> +@code{off_t} has 64 bits, which makes it possible to handle files up to
> +@twoexp{63} bytes in length.
> +
> +The return value is a count of bytes (@emph{not} buffers) read, @math{0}
> +indicating end-of-file, or @math{-1} indicating an error. The possible
> +errors are the same as in @code{preadv} with the addition of:
> +
> +@table @code
> +
> +@item EOPNOTSUPP
> +
> +@c The default sysdeps/posix code will return it for any flags value
> +@c different than 0.
> +An unsupported @var{flags} was used.
> +
> +@end table
> +
> +@end deftypefun
> +
> +@comment unistd.h
> +@comment GNU
> +@deftypefun ssize_t preadv64v2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}, int @var{flags})
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
> +@c is also MT-Safe since it calls preadv.
> +
> +This function is similar to the @code{preadv2} function with the difference
> +is that the @var{offset} parameter is of type @code{off64_t} instead of
> +@code{off_t}. It makes it possible on 32 bit machines to address
> +files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The
> +file descriptor @code{filedes} must be opened using @code{open64} since
> +otherwise the large offsets possible with @code{off64_t} will lead to
> +errors with a descriptor in small file mode.
> +
> +When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
> +32 bit machine this function is actually available under the name
> +@code{preadv2} and so transparently replaces the 32 bit interface.
> +@end deftypefun
> +
> +
> +@comment sys/uio.h
> +@comment GNU
> +@deftypefun ssize_t pwritev2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}, int @var{flags})
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
> +@c is also MT-Safe since it calls pwritev.
> +
> +This function is similar to the @code{pwritev} function, with the difference
> +it adds an extra @var{flags} parameter of type @code{int}. The supported
> +@var{flags} are dependent of the underlying system and for Linux it supports
> +the same ones as for @code{preadv2}.
> +
> +When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
> +@code{pwritev2} function is in fact @code{pwritev64v2} and the type
> +@code{off_t} has 64 bits, which makes it possible to handle files up to
> +@twoexp{63} bytes in length.
> +
> +The return value is a count of bytes (@emph{not} buffers) write, @math{0}
> +indicating end-of-file, or @math{-1} indicating an error. The possible
> +errors are the same as in @code{preadv2}.
> +@end deftypefun
> +
> +@comment unistd.h
> +@comment GNU
> +@deftypefun ssize_t pwritev64v2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}, int @var{flags})
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
> +@c is also MT-Safe since it calls pwritev.
> +
> +This function is similar to the @code{pwritev2} function with the difference
> +is that the @var{offset} parameter is of type @code{off64_t} instead of
> +@code{off_t}. It makes it possible on 32 bit machines to address
> +files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The
> +file descriptor @code{filedes} must be opened using @code{open64} since
> +otherwise the large offsets possible with @code{off64_t} will lead to
> +errors with a descriptor in small file mode.
> +
> +When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
> +32 bit machine this function is actually available under the name
> +@code{pwritev2} and so transparently replaces the 32 bit interface.
> +@end deftypefun
> +
>
> @node File Position Primitive
> @section Setting the File Position of a Descriptor
> diff --git a/misc/Makefile b/misc/Makefile
> index 622da67..bed46d7 100644
> --- a/misc/Makefile
> +++ b/misc/Makefile
> @@ -39,6 +39,7 @@ headers := sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
>
> routines := brk sbrk sstk ioctl \
> readv writev preadv preadv64 pwritev pwritev64 \
> + preadv2 preadv64v2 pwritev2 pwritev64v2 \
> setreuid setregid \
> seteuid setegid \
> getpagesize \
> @@ -79,7 +80,9 @@ gpl2lgpl := error.c error.h
> tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
> tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
> tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 \
> - tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \
> + tst-preadvwritev tst-preadvwritev64 tst-preadvwritev2 \
> + tst-preadvwritev64v2 \
> + tst-makedev tst-empty \
> tst-atomic tst-atomic-long
> tests-static := tst-empty
>
> diff --git a/misc/Versions b/misc/Versions
> index f2c90ff..bafda78 100644
> --- a/misc/Versions
> +++ b/misc/Versions
> @@ -155,6 +155,9 @@ libc {
> GLIBC_2.25 {
> gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;
> }
> + GLIBC_2.26 {
> + preadv2; preadv64v2; pwritev2; pwritev64v2;
> + }
> GLIBC_PRIVATE {
> __madvise;
> __mktemp;
> diff --git a/misc/preadv2.c b/misc/preadv2.c
> new file mode 100644
> index 0000000..a62dcaa
> --- /dev/null
> +++ b/misc/preadv2.c
> @@ -0,0 +1,30 @@
> +/* Default implementation of preadv2.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <sys/uio.h>
> +
> +/* Same as preadv but with an additional flags argument. */
> +ssize_t
> +preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
> + int flags)
> +{
> + __set_errno (ENOSYS);
> + return -1;
> +}
> +
> +stub_warning (preadv2)
> diff --git a/misc/preadv64v2.c b/misc/preadv64v2.c
> new file mode 100644
> index 0000000..a802c2f
> --- /dev/null
> +++ b/misc/preadv64v2.c
> @@ -0,0 +1,30 @@
> +/* Default implementation of preadv2 (LFS version).
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <sys/uio.h>
> +
> +/* Same as preadv64 but with an addional flag argument. */
> +ssize_t
> +preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
> + int flags)
> +{
> + __set_errno (ENOSYS);
> + return -1;
> +}
> +
> +stub_warning (preadv64v2)
> diff --git a/misc/pwritev2.c b/misc/pwritev2.c
> new file mode 100644
> index 0000000..b9e0727
> --- /dev/null
> +++ b/misc/pwritev2.c
> @@ -0,0 +1,30 @@
> +/* Default implementation of pwritev2.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <sys/uio.h>
> +
> +/* Same as pwritev but with an additional flags argument. */
> +ssize_t
> +pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
> + int flags)
> +{
> + __set_errno (ENOSYS);
> + return -1;
> +}
> +
> +stub_warning (pwritev2)
> diff --git a/misc/pwritev64v2.c b/misc/pwritev64v2.c
> new file mode 100644
> index 0000000..1f874f0
> --- /dev/null
> +++ b/misc/pwritev64v2.c
> @@ -0,0 +1,30 @@
> +/* Default implementation of pwritev2 (LFS version).
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <sys/uio.h>
> +
> +/* Same as preadv64 but with an addional flag argument. */
> +ssize_t
> +pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
> + int flags)
> +{
> + __set_errno (ENOSYS);
> + return -1;
> +}
> +
> +stub_warning (pwritev64v2)
> diff --git a/misc/sys/uio.h b/misc/sys/uio.h
> index e80f013..66c22f0 100644
> --- a/misc/sys/uio.h
> +++ b/misc/sys/uio.h
> @@ -76,6 +76,7 @@ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
> __THROW. */
> extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
> __off_t __offset) __wur;
> +
> # else
> # ifdef __REDIRECT
> extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec,
> @@ -117,6 +118,46 @@ extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count,
> # endif
> #endif /* Use misc. */
>
> +
> +#ifdef __USE_GNU
> +# ifndef __USE_FILE_OFFSET64
> +/* Same as preadv but with an additional flag argumenti defined at uio.h. */
> +extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count,
> + __off_t __offset, int ___flags) __wur;
> +
> +/* Same as preadv but with an additional flag argument defined at uio.h. */
> +extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count,
> + __off_t __offset, int __flags) __wur;
> +
> +# else
> +# ifdef __REDIRECT
> +extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec,
> + int __count, __off64_t __offset,
> + int __flags),
> + pwritev64v2) __wur;
> +extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec,
> + int __count, __off64_t __offset,
> + int __flags),
> + preadv64v2) __wur;
> +# else
> +# define preadv2 preadv64v2
> +# define pwritev2 pwritev64v2
> +# endif
> +# endif
> +
> +# ifdef __USE_LARGEFILE64
> +/* Same as preadv but with an additional flag argumenti defined at uio.h. */
> +extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec,
> + int __count, __off64_t __offset,
> + int ___flags) __wur;
> +
> +/* Same as preadv but with an additional flag argument defined at uio.h. */
> +extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev,
> + int __count, __off64_t __offset,
> + int __flags) __wur;
> +# endif
> +#endif /* Use GNU. */
> +
> __END_DECLS
>
> #endif /* sys/uio.h */
> diff --git a/misc/tst-preadvwritev-common.c b/misc/tst-preadvwritev-common.c
> index 5540dfb..676d495 100644
> --- a/misc/tst-preadvwritev-common.c
> +++ b/misc/tst-preadvwritev-common.c
> @@ -18,6 +18,7 @@
>
> #include <stdio.h>
> #include <stdint.h>
> +#include <errno.h>
> #include <string.h>
> #include <sys/uio.h>
> #include <sys/stat.h>
> @@ -39,6 +40,16 @@ do_prepare (int argc, char **argv)
> }
> #define PREPARE do_prepare
>
> +#ifndef PREADV
> +# define PREADV(__fd, __iov, __iovcnt, __offset) \
> + preadv (__fd, __iov, __iovcnt, __offset)
> +#endif
> +
> +#ifndef PWRITEV
> +# define PWRITEV(__fd, __iov, __iovcnt, __offset) \
> + pwritev (__fd, __iov, __iovcnt, __offset)
> +#endif
> +
> static int
> do_test_with_offset (off_t offset)
> {
> @@ -58,13 +69,13 @@ do_test_with_offset (off_t offset)
> iov[1].iov_base = buf2;
> iov[1].iov_len = sizeof buf2;
>
> - ret = pwritev (temp_fd, iov, 2, offset);
> + ret = PWRITEV (temp_fd, iov, 2, offset);
> if (ret == -1)
> FAIL_RET ("first pwritev returned -1");
> if (ret != (sizeof buf1 + sizeof buf2))
> FAIL_RET ("first pwritev returned an unexpected value");
>
> - ret = pwritev (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset);
> + ret = PWRITEV (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset);
> if (ret == -1)
> FAIL_RET ("second pwritev returned -1");
> if (ret != (sizeof buf1 + sizeof buf2))
> @@ -82,7 +93,7 @@ do_test_with_offset (off_t offset)
> iov[1].iov_len = sizeof buf4;
>
> /* Now read two buffer with 32 and 64 bytes respectively. */
> - ret = preadv (temp_fd, iov, 2, offset);
> + ret = PREADV (temp_fd, iov, 2, offset);
> if (ret == -1)
> FAIL_RET ("first preadv returned -1");
> if (ret != (sizeof buf3 + sizeof buf4))
> @@ -93,7 +104,7 @@ do_test_with_offset (off_t offset)
> if (memcmp (buf2, buf4, sizeof buf2) != 0)
> FAIL_RET ("second buffer from first preadv different than expected");
>
> - ret = preadv (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset);
> + ret = PREADV (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset);
> if (ret == -1)
> FAIL_RET ("second preadv returned -1");
> if (ret != (sizeof buf3 + sizeof buf4))
> diff --git a/misc/tst-preadvwritev2.c b/misc/tst-preadvwritev2.c
> new file mode 100644
> index 0000000..cf36272
> --- /dev/null
> +++ b/misc/tst-preadvwritev2.c
> @@ -0,0 +1,31 @@
> +/* Tests for preadv2 and pwritev2.
> + Copyright (C) 2016-2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#define PREADV(__fd, __iov, __iovcnt, __offset) \
> + preadv2 (__fd, __iov, __iovcnt, __offset, 0)
> +
> +#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
> + pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
> +
> +#include "tst-preadvwritev-common.c"
> +
> +static int
> +do_test (void)
> +{
> + return do_test_with_offset (0);
> +}
> diff --git a/misc/tst-preadvwritev64v2.c b/misc/tst-preadvwritev64v2.c
> new file mode 100644
> index 0000000..8d0c48e
> --- /dev/null
> +++ b/misc/tst-preadvwritev64v2.c
> @@ -0,0 +1,33 @@
> +/* Tests for preadv2 and pwritev2 (LFS version).
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#define _FILE_OFFSET_BITS 64
> +
> +#define PREADV(__fd, __iov, __iovcnt, __offset) \
> + preadv2 (__fd, __iov, __iovcnt, __offset, 0)
> +
> +#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
> + pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
> +
> +#include "tst-preadvwritev-common.c"
> +
> +static int
> +do_test (void)
> +{
> + return do_test_with_offset (0);
> +}
> diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c
> index e66961f..7a560a1 100644
> --- a/nptl/tst-cancel4.c
> +++ b/nptl/tst-cancel4.c
> @@ -1079,6 +1079,75 @@ tf_pwritev (void *arg)
> }
>
> static void *
> +tf_pwritev2 (void *arg)
> +{
> + int fd;
> +
> + if (arg == NULL)
> + /* XXX If somebody can provide a portable test case in which pwritev2
> + blocks we can enable this test to run in both rounds. */
> + abort ();
> +
> + errno = 0;
> +
> + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
> + tempfd = fd = mkstemp (fname);
> + if (fd == -1)
> + FAIL_EXIT1 ("mkstemp: %m");
> + unlink (fname);
> +
> + xpthread_barrier_wait (&b2);
> +
> + xpthread_barrier_wait (&b2);
> +
> + ssize_t s;
> + pthread_cleanup_push (cl, NULL);
> +
> + char buf[WRITE_BUFFER_SIZE];
> + memset (buf, '\0', sizeof (buf));
> + struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
> + s = pwritev2 (fd, iov, 1, 0, 0);
> +
> + pthread_cleanup_pop (0);
> +
> + FAIL_EXIT1 ("pwritev2 returns with %zd", s);
> +}
> +
> +static void *
> +tf_preadv2 (void *arg)
> +{
> + int fd;
> +
> + if (arg == NULL)
> + /* XXX If somebody can provide a portable test case in which preadv2
> + blocks we can enable this test to run in both rounds. */
> + abort ();
> +
> + errno = 0;
> +
> + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
> + tempfd = fd = mkstemp (fname);
> + if (fd == -1)
> + FAIL_EXIT1 ("mkstemp failed: %m");
> + unlink (fname);
> +
> + xpthread_barrier_wait (&b2);
> +
> + xpthread_barrier_wait (&b2);
> +
> + ssize_t s;
> + pthread_cleanup_push (cl, NULL);
> +
> + char buf[100];
> + struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
> + s = preadv2 (fd, iov, 1, 0, 0);
> +
> + pthread_cleanup_pop (0);
> +
> + FAIL_EXIT1 ("preadv2 returns with %zd", s);
> +}
> +
> +static void *
> tf_fsync (void *arg)
> {
> if (arg == NULL)
> @@ -1473,7 +1542,9 @@ struct cancel_tests tests[] =
> ADD_TEST (recvfrom, 2, 0),
> ADD_TEST (recvmsg, 2, 0),
> ADD_TEST (preadv, 2, 1),
> + ADD_TEST (preadv2, 2, 1),
> ADD_TEST (pwritev, 2, 1),
> + ADD_TEST (pwritev2, 2, 1),
> ADD_TEST (open, 2, 1),
> ADD_TEST (close, 2, 1),
> ADD_TEST (pread, 2, 1),
> diff --git a/sysdeps/posix/preadv2.c b/sysdeps/posix/preadv2.c
> new file mode 100644
> index 0000000..2a7cf11
> --- /dev/null
> +++ b/sysdeps/posix/preadv2.c
> @@ -0,0 +1,38 @@
> +/* Generic version of preadv2.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <unistd.h>
> +#include <sys/uio.h>
> +
> +#ifndef __OFF_T_MATCHES_OFF64_T
> +
> +/* Since we define no flags for preadv2 just route to preadv. */
> +ssize_t
> +preadv2 (int fd, const struct iovec *vector, int count, OFF_T offset,
> + int flags)
> +{
> + if (flags != 0)
> + {
> + __set_errno (EOPNOTSUPP);
> + return -1;
> + }
> +
> + return preadv (fd, vector, count, offset);
> +}
> +
> +#endif
> diff --git a/sysdeps/posix/preadv64v2.c b/sysdeps/posix/preadv64v2.c
> new file mode 100644
> index 0000000..e084f3f
> --- /dev/null
> +++ b/sysdeps/posix/preadv64v2.c
> @@ -0,0 +1,37 @@
> +/* Generic version of preadv2.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <unistd.>
> +#include <sys/uio.h>
> +
> +ssize_t
> +preadv64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
> + int flags)
> +{
> + if (flags != 0)
> + {
> + __set_errno (EOPNOTSUPP);
> + return -1;
> + }
> +
> + return preadv64 (fd, vector, count, offset);
> +}
> +
> +#ifdef __OFF_T_MATCHES_OFF64_T
> +strong_alias (preadv64v2, preadv2)
> +#endif
> diff --git a/sysdeps/posix/pwritev2.c b/sysdeps/posix/pwritev2.c
> new file mode 100644
> index 0000000..5b7650c
> --- /dev/null
> +++ b/sysdeps/posix/pwritev2.c
> @@ -0,0 +1,38 @@
> +/* Generic version of pwritev2.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <unistd.h>
> +#include <sys/uio.h>
> +
> +#ifndef __OFF_T_MATCHES_OFF64_T
> +
> +/* Since we define no flags for pwritev2 just route to pwritev. */
> +ssize_t
> +pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset,
> + int flags)
> +{
> + if (flags != 0)
> + {
> + __set_errno (EOPNOTSUPP);
> + return -1;
> + }
> +
> + return pwritev (fd, vector, count, offset);
> +}
> +
> +#endif
> diff --git a/sysdeps/posix/pwritev64v2.c b/sysdeps/posix/pwritev64v2.c
> new file mode 100644
> index 0000000..d9727b9
> --- /dev/null
> +++ b/sysdeps/posix/pwritev64v2.c
> @@ -0,0 +1,38 @@
> +/* Generic version of pwritev2.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <unistd.h>
> +#include <sys/uio.h>
> +
> +/* Since we define no flags for pwritev2 just route to pwritev. */
> +ssize_t
> +pwritev64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
> + int flags)
> +{
> + if (flags != 0)
> + {
> + __set_errno (EOPNOTSUPP);
> + return -1;
> + }
> +
> + return pwritev64 (fd, vector, count, offset);
> +}
> +
> +#ifdef __OFF_T_MATCHES_OFF64_T
> +strong_alias (pwritev64v2, pwritev2)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 58d768c..296f2a5 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2097,3 +2097,8 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index 906050d..8006e72 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2008,6 +2008,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
> index 66112dd..29f9688 100644
> --- a/sysdeps/unix/sysv/linux/arm/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
> @@ -98,6 +98,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.4 GLIBC_2.4 A
> GLIBC_2.4 _Exit F
> GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/bits/uio.h b/sysdeps/unix/sysv/linux/bits/uio.h
> index 1583f04..d5701f8 100644
> --- a/sysdeps/unix/sysv/linux/bits/uio.h
> +++ b/sysdeps/unix/sysv/linux/bits/uio.h
> @@ -69,4 +69,10 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
> __END_DECLS
>
> # endif
> +
> +/* Flags for preadv2/pwritev2: */
> +#define RWF_HIPRI 0x00000001 /* High priority request. */
> +#define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC. */
> +#define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */
> +
> #endif
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index 3ddadd2..e9cfbaf 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -1862,6 +1862,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index 977ab90..c6ad3c3 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2020,6 +2020,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index c7edb9a..d0055a2 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -1884,6 +1884,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index b981466..8ee1af7 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -137,3 +137,8 @@
> /* Support for SysV IPC through wired syscalls. All supported architectures
> either support ipc syscall and/or all the ipc correspondent syscalls. */
> #define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1
> +
> +/* Support for p{read,write}v2 was added in 4.6. However Linux default
> + implementation does not assume the __ASSUME_* and instead use a fallback
> + implementation based on p{read,write}v and returning an error for
> + non supported flags. */
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index 450be4e..3777676 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -99,6 +99,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.4 GLIBC_2.4 A
> GLIBC_2.4 _Exit F
> GLIBC_2.4 _IO_2_1_stderr_ D 0x98
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 9e016bd..8b1f80c 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -1976,6 +1976,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
> index 1a455be..d4db9a8 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
> @@ -2097,3 +2097,8 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index 8eb5e66..f430bdb 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -1951,6 +1951,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index 416d9ac..a4dca19 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -1949,6 +1949,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index f4949e5..0814fa8 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -1947,6 +1947,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index c7375ae..a0bdeff 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -1942,6 +1942,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index 724a0e3..b201290 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2138,3 +2138,8 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index 2dc32b6..6e7ff24 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -1980,6 +1980,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index 5658109..19c7c7d 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -1985,6 +1985,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
> index c761221..e94ce38 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
> @@ -2185,3 +2185,8 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
> index 265c769..f3daa33 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
> @@ -99,6 +99,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 _Exit F
> GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
> diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c
> index 7d971cc..ecabc8c 100644
> --- a/sysdeps/unix/sysv/linux/preadv.c
> +++ b/sysdeps/unix/sysv/linux/preadv.c
> @@ -50,4 +50,6 @@ preadv (int fd, const struct iovec *vector, int count, off_t offset)
> # define OFF_T off_t
> # include <sysdeps/posix/preadv_common.c>
> # endif /* __ASSUME_PREADV */
> +
> +libc_hidden_def (preadv)
> #endif
> diff --git a/sysdeps/unix/sysv/linux/preadv2.c b/sysdeps/unix/sysv/linux/preadv2.c
> new file mode 100644
> index 0000000..11fe85e
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/preadv2.c
> @@ -0,0 +1,55 @@
> +/* Linux implementation of preadv2.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <sys/uio.h>
> +#include <sysdep-cancel.h>
> +
> +#ifndef __OFF_T_MATCHES_OFF64_T
> +
> +# if !defined (__NR_preadv2) && defined (__NR_pread64v2)
> +# define __NR_preadv2 __NR_pread64v2
> +# endif
> +
> +ssize_t
> +preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
> + int flags)
> +{
> +# ifdef __NR_preadv2
> + ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
> + LO_HI_LONG (offset), flags);
> + if (result >= 0 || errno != ENOSYS)
> + return result;
> +# endif
> + /* Trying to emulate the preadv2 syscall flags is troublesome:
> +
> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
> + fcntl are silently ignored).
> +
> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
> + semantic not provided by any other flag (O_NONBLOCK for instance). */
> +
> + if (flags != 0)
> + {
> + __set_errno (EOPNOTSUPP);
> + return -1;
> + }
> + return preadv (fd, vector, count, offset);
> +}
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/preadv64.c b/sysdeps/unix/sysv/linux/preadv64.c
> index 66daa74..c96b214 100644
> --- a/sysdeps/unix/sysv/linux/preadv64.c
> +++ b/sysdeps/unix/sysv/linux/preadv64.c
> @@ -48,7 +48,9 @@ preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
> # define OFF_T off64_t
> # include <sysdeps/posix/preadv_common.c>
> #endif
> +libc_hidden_def (preadv64)
>
> #ifdef __OFF_T_MATCHES_OFF64_T
> strong_alias (preadv64, preadv)
> +libc_hidden_def (preadv)
> #endif
> diff --git a/sysdeps/unix/sysv/linux/preadv64v2.c b/sysdeps/unix/sysv/linux/preadv64v2.c
> new file mode 100644
> index 0000000..9d7f8c9
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/preadv64v2.c
> @@ -0,0 +1,55 @@
> +/* Linux implementation of preadv2 (LFS version).
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <sys/uio.h>
> +#include <sysdep-cancel.h>
> +
> +#if !defined(__NR_preadv64v2) && defined(__NR_preadv2)
> +# define __NR_preadv64v2 __NR_preadv2
> +#endif
> +
> +ssize_t
> +preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
> + int flags)
> +{
> +#ifdef __NR_preadv64v2
> + ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
> + LO_HI_LONG (offset), flags);
> + if (result >= 0 || errno != ENOSYS)
> + return result;
> +#endif
> + /* Trying to emulate the preadv2 syscall flags is troublesome:
> +
> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
> + fcntl are silently ignored).
> +
> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
> + semantic not provided by any other flag (O_NONBLOCK for instance). */
> +
> + if (flags != 0)
> + {
> + __set_errno (EOPNOTSUPP);
> + return -1;
> + }
> + return preadv64 (fd, vector, count, offset);
> +}
> +
> +#ifdef __OFF_T_MATCHES_OFF64_T
> +strong_alias (preadv64v2, preadv2)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
> index 57e5d20..71959c0 100644
> --- a/sysdeps/unix/sysv/linux/pwrite64.c
> +++ b/sysdeps/unix/sysv/linux/pwrite64.c
> @@ -28,6 +28,7 @@ __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
> {
> return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL64_PRW (offset));
> }
> +
> weak_alias (__libc_pwrite64, __pwrite64)
> libc_hidden_weak (__pwrite64)
> weak_alias (__libc_pwrite64, pwrite64)
> diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c
> index ce02996..7545cb3 100644
> --- a/sysdeps/unix/sysv/linux/pwritev.c
> +++ b/sysdeps/unix/sysv/linux/pwritev.c
> @@ -50,4 +50,6 @@ pwritev (int fd, const struct iovec *vector, int count, off_t offset)
> # define OFF_T off_t
> # include <sysdeps/posix/pwritev_common.c>
> # endif /* __ASSUME_PREADV */
> +
> +libc_hidden_def (pwritev)
> #endif
> diff --git a/sysdeps/unix/sysv/linux/pwritev2.c b/sysdeps/unix/sysv/linux/pwritev2.c
> new file mode 100644
> index 0000000..72f0471
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/pwritev2.c
> @@ -0,0 +1,51 @@
> +/* Linux implementation of pwritev2.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <sys/uio.h>
> +#include <sysdep-cancel.h>
> +
> +#ifndef __OFF_T_MATCHES_OFF64_T
> +
> +ssize_t
> +pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
> + int flags)
> +{
> +# ifdef __NR_pwritev2
> + ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
> + LO_HI_LONG (offset), flags);
> + if (result >= 0 || errno != ENOSYS)
> + return result;
> +# endif
> + /* Trying to emulate the pwritev2 syscall flags is troublesome:
> +
> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
> + fcntl are silently ignored).
> +
> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
> + semantic not provided by any other flag (O_NONBLOCK for instance). */
> +
> + if (flags != 0)
> + {
> + __set_errno (EOPNOTSUPP);
> + return -1;
> + }
> + return pwritev (fd, vector, count, offset);
> +}
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/pwritev64.c b/sysdeps/unix/sysv/linux/pwritev64.c
> index 45fb90b..9dc4e55 100644
> --- a/sysdeps/unix/sysv/linux/pwritev64.c
> +++ b/sysdeps/unix/sysv/linux/pwritev64.c
> @@ -48,7 +48,9 @@ pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
> # define OFF_T off64_t
> # include <sysdeps/posix/pwritev_common.c>
> #endif
> +libc_hidden_def (pwritev64)
>
> #ifdef __OFF_T_MATCHES_OFF64_T
> strong_alias (pwritev64, pwritev)
> +libc_hidden_def (pwritev)
> #endif
> diff --git a/sysdeps/unix/sysv/linux/pwritev64v2.c b/sysdeps/unix/sysv/linux/pwritev64v2.c
> new file mode 100644
> index 0000000..def9a0b
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/pwritev64v2.c
> @@ -0,0 +1,55 @@
> +/* Linux implementation of pwritev2 (LFS version).
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <sys/uio.h>
> +#include <sysdep-cancel.h>
> +
> +#if !defined(__NR_pwritev64v2) && defined(__NR_pwritev2)
> +# define __NR_pwritev64v2 __NR_pwritev2
> +#endif
> +
> +ssize_t
> +pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
> + int flags)
> +{
> +#ifdef __NR_pwritev64v2
> + ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
> + LO_HI_LONG (offset), flags);
> + if (result >= 0 || errno != ENOSYS)
> + return result;
> +#endif
> + /* Trying to emulate the pwritev2 syscall flags is troublesome:
> +
> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
> + fcntl are silently ignored).
> +
> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
> + semantic not provided by any other flag (O_NONBLOCK for instance). */
> +
> + if (flags != 0)
> + {
> + __set_errno (EOPNOTSUPP);
> + return -1;
> + }
> + return pwritev64 (fd, vector, count, offset);
> +}
> +
> +#ifdef __OFF_T_MATCHES_OFF64_T
> +strong_alias (pwritev64v2, pwritev2)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index ed1b6bf..eb9e72f 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -1980,6 +1980,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index 2e75d29..1402959 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -1881,6 +1881,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
> index bd74c0c..e9eefcb 100644
> --- a/sysdeps/unix/sysv/linux/sh/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
> @@ -1866,6 +1866,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index 5584838..967699e 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -1972,6 +1972,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index efedbe2..9dd938a 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -1910,6 +1910,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
> index ffd988a..68c9887 100644
> --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
> index f0c13ce..97aa0f7 100644
> --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> diff --git a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
> index ffd988a..68c9887 100644
> --- a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index f57004c..2032659 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -1861,6 +1861,11 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
> GLIBC_2.3 GLIBC_2.3 A
> GLIBC_2.3 __ctype_b_loc F
> GLIBC_2.3 __ctype_tolower_loc F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index 05629e1..11a278c 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
> GLIBC_2.25 strfromd F
> GLIBC_2.25 strfromf F
> GLIBC_2.25 strfroml F
> +GLIBC_2.26 GLIBC_2.26 A
> +GLIBC_2.26 preadv2 F
> +GLIBC_2.26 preadv64v2 F
> +GLIBC_2.26 pwritev2 F
> +GLIBC_2.26 pwritev64v2 F
>
Ping x2. Any impeding issue about this patch? Otherwise I would like to push it.
On 11/05/2017 16:01, Adhemerval Zanella wrote:
> Ping.
>
> On 04/05/2017 09:43, Adhemerval Zanella wrote:
>> Change from previous version:
>>
>> * Add unsupported flag check for Linux implementation.
>>
>> * Unsupported/invalid flags now return EOPNOTSUPP instead of
>> EINVAL.
>>
>> * Add comment about preadv2 and pwritev2 support on kernel-features.h.
>>
>> * Add NEWS entry.
>>
>> * Fix typo in documentation.
>>
>> --
>>
>> This patch adds support of preadv2 and pwritev2 which are similar to
>> preadv/pwritev but adds an extra flag argument. As for preadv/pwritev
>> both interfaces are added a non-standard standard GNU API.
>>
>> On default 'posix' implementation trying to emulate the Linux supported
>> flags is troublesome:
>>
>> * We can not temporary change the file state of the O_DSYNC and O_SYNC
>> flags to emulate RWF_{D}SYNC (attempts to change the state of using
>> fcntl are silently ignored).
>>
>> * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>> semantic not provided by any other flag (O_NONBLOCK for instance).
>>
>> So default sysdeps/posix implementations fails with EINVAL for any non
>> supported flag (which are none currently) calls generic preadv/pwritev.
>> Basically, it supports only preadv2 called as preadv (with flags sets
>> to 0).
>>
>> The Linux one uses the preadv2/pwritev2 syscall if defined, otherwise it
>> call preadv/writev. Instead of using the previous __ASSUME_* to
>> unconditionally issue the syscall (and avoid building the fallback routine),
>> it call pread/write if the preadv2/pwritev2 syscalls fails. The idea
>> is just avoid adding another __ASSUME_* and checking each architecture
>> on every kernel bump and simplify code conditionals.
>>
>> Checked on x86_64-linux-gnu and on i686-linux-gnu and a check with
>> run-built-tests=no on aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
>> ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips{64,64n32}-linux-gnu,
>> nios2-linux-gnu, powerpc{64,64le}-linux-gnu, s390{x}-linux-gnu,
>> sparc{64,v9}-linux-gnu, tile{gx,pro}-linux-gnu, and sh4-linux-gnu (all using
>> gcc 6.3).
>>
>> * NEWS: Add note about pwritev2 and preadv2 inclusion.
>> * misc/Makefile (routines): Add preadv2, preadv64v2, pwritev2, and
>> pwritev64v2.
>> (tests): Add tst-preadvwritev2 and tst-preadvwritev64v2.
>> * misc/Versions (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, and
>> pwritev64v2.
>> * misc/preadv2.c: New file.
>> * misc/preadv64v2.c: Likewise.
>> * misc/pwritev2.c: Likewise.
>> * misc/pwritev64v2.c: Likewise.
>> * misc/tst-preadvwritev2.c: Likewise.
>> * misc/tst-preadvwritev64v2.c: Likewise.
>> * manual/llio.texi: Add preadv2 and pwritev2 documentation.
>> * misc/sys/uio.h [__USE_GNU && !__USE_FILE_OFFSET64] (preadv2): New
>> prototype.
>> [__USE_GNU && !__USE_FILE_OFFSET64] (pwritev2): Likewise.
>> [__USE_GNU && __USE_FILE_OFFSET64] (preadv64v2): Likewise.
>> [__USE_GNU && __USE_FILE_OFFSET64] (pwritev64v2): Likewise.
>> * misc/tst-preadvwritev-common.c (PREADV): Define if not defined.
>> (PWRITEV): Likewise.
>> (do_test_with_offset): Use PREADV and PWRITEV macros and check for
>> ENOSYS.
>> * nptl/tst-cancel4.c (tf_pwritev2): New test.
>> (tf_preadv2): Likewise.
>> (tf_fsync): Add tf_pwritev2 and tf_preadv2.
>> * sysdeps/posix/preadv2.c: Likewise.
>> * sysdeps/posix/preadv64v2.c: Likewise.
>> * sysdeps/posix/pwritev2.c: Likewise.
>> * sysdeps/posix/pwritev64v2.c: Likewise.
>> * sysdeps/unix/sysv/linux/kernel-features.h: Add comment for syscall
>> support in kernel.
>> * sysdeps/unix/sysv/linux/preadv2.c: Likewise.
>> * sysdeps/unix/sysv/linux/preadv64v2.c: Likewise.
>> * sysdeps/unix/sysv/linux/pwritev2.c: Likewise.
>> * sysdeps/unix/sysv/linux/pwritev64v2.c: Likewise.
>> * sysdeps/unix/sysv/linux/preadv.c (preadv): Add libc_hidden_def.
>> * sysdeps/unix/sysv/linux/preadv64.c (preadv64): Likewise.
>> * sysdeps/unix/sysv/linux/pwritev.c (pwritev): Likewise.
>> * sysdeps/unix/sysv/linux/pwritev64.c (pwritev64): Likewise.
>> * sysdeps/unix/sysv/linux/bits/uio.h: Add supported preadv2/pwritev2
>> support flags on Linux.
>> * sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.26): Add
>> preadv2, preadv64v2, pwritev2, pwritev64v2.
>> * sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>> (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>> (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
>> (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.26): Likewise.
>> * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/sysv/linux/tile/tilegx/tilegx32/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/sysv/linux/tile/tilegx/tilegx64/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.26):
>> Likewise.
>> * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.26):
>> Likewise.
>> ---
>> ChangeLog | 91 +++++++++++++++++
>> NEWS | 7 ++
>> include/sys/uio.h | 6 ++
>> manual/llio.texi | 109 +++++++++++++++++++++
>> misc/Makefile | 5 +-
>> misc/Versions | 3 +
>> misc/preadv2.c | 30 ++++++
>> misc/preadv64v2.c | 30 ++++++
>> misc/pwritev2.c | 30 ++++++
>> misc/pwritev64v2.c | 30 ++++++
>> misc/sys/uio.h | 41 ++++++++
>> misc/tst-preadvwritev-common.c | 19 +++-
>> misc/tst-preadvwritev2.c | 31 ++++++
>> misc/tst-preadvwritev64v2.c | 33 +++++++
>> nptl/tst-cancel4.c | 71 ++++++++++++++
>> sysdeps/posix/preadv2.c | 38 +++++++
>> sysdeps/posix/preadv64v2.c | 37 +++++++
>> sysdeps/posix/pwritev2.c | 38 +++++++
>> sysdeps/posix/pwritev64v2.c | 38 +++++++
>> sysdeps/unix/sysv/linux/aarch64/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/alpha/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/arm/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/bits/uio.h | 6 ++
>> sysdeps/unix/sysv/linux/hppa/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/i386/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/ia64/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/kernel-features.h | 5 +
>> sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/microblaze/libc.abilist | 5 +
>> .../unix/sysv/linux/mips/mips32/fpu/libc.abilist | 5 +
>> .../unix/sysv/linux/mips/mips32/nofpu/libc.abilist | 5 +
>> .../unix/sysv/linux/mips/mips64/n32/libc.abilist | 5 +
>> .../unix/sysv/linux/mips/mips64/n64/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/nios2/libc.abilist | 5 +
>> .../sysv/linux/powerpc/powerpc32/fpu/libc.abilist | 5 +
>> .../linux/powerpc/powerpc32/nofpu/libc.abilist | 5 +
>> .../sysv/linux/powerpc/powerpc64/libc-le.abilist | 5 +
>> .../unix/sysv/linux/powerpc/powerpc64/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/preadv.c | 2 +
>> sysdeps/unix/sysv/linux/preadv2.c | 55 +++++++++++
>> sysdeps/unix/sysv/linux/preadv64.c | 2 +
>> sysdeps/unix/sysv/linux/preadv64v2.c | 55 +++++++++++
>> sysdeps/unix/sysv/linux/pwrite64.c | 1 +
>> sysdeps/unix/sysv/linux/pwritev.c | 2 +
>> sysdeps/unix/sysv/linux/pwritev2.c | 51 ++++++++++
>> sysdeps/unix/sysv/linux/pwritev64.c | 2 +
>> sysdeps/unix/sysv/linux/pwritev64v2.c | 55 +++++++++++
>> sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/sh/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist | 5 +
>> .../sysv/linux/tile/tilegx/tilegx32/libc.abilist | 5 +
>> .../sysv/linux/tile/tilegx/tilegx64/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/x86_64/64/libc.abilist | 5 +
>> sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist | 5 +
>> 58 files changed, 1058 insertions(+), 5 deletions(-)
>> create mode 100644 misc/preadv2.c
>> create mode 100644 misc/preadv64v2.c
>> create mode 100644 misc/pwritev2.c
>> create mode 100644 misc/pwritev64v2.c
>> create mode 100644 misc/tst-preadvwritev2.c
>> create mode 100644 misc/tst-preadvwritev64v2.c
>> create mode 100644 sysdeps/posix/preadv2.c
>> create mode 100644 sysdeps/posix/preadv64v2.c
>> create mode 100644 sysdeps/posix/pwritev2.c
>> create mode 100644 sysdeps/posix/pwritev64v2.c
>> create mode 100644 sysdeps/unix/sysv/linux/preadv2.c
>> create mode 100644 sysdeps/unix/sysv/linux/preadv64v2.c
>> create mode 100644 sysdeps/unix/sysv/linux/pwritev2.c
>> create mode 100644 sysdeps/unix/sysv/linux/pwritev64v2.c
>>
>> diff --git a/NEWS b/NEWS
>> index 5558ca3..afad4b1 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -57,6 +57,13 @@ Version 2.26
>> be added on next major revision of POSIX, so current support is enabled
>> with _GNU_SOURCE.
>>
>> +* New preadv2 and pwritev2 are added to libc. They are Linux extensions to
>> + preadv and pwritev with an additional flag argument where it is possible
>> + to set high priority or use O_DSYNC or O_SYNC for an specific IO operation.
>> + For complete support it requires Linux kernel version 4.6, otherwise a
>> + compat implementation will be used (which refuses all flags and routes it
>> + to preadv or pwritev).
>> +
>> Security related changes:
>>
>> * The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes,
>> diff --git a/include/sys/uio.h b/include/sys/uio.h
>> index f44ce18..20860bf 100644
>> --- a/include/sys/uio.h
>> +++ b/include/sys/uio.h
>> @@ -7,5 +7,11 @@ extern ssize_t __readv (int __fd, const struct iovec *__iovec,
>> int __count);
>> extern ssize_t __writev (int __fd, const struct iovec *__iovec,
>> int __count);
>> +
>> +/* Used for p{read,write}{v64}v2 implementation. */
>> +libc_hidden_proto (preadv)
>> +libc_hidden_proto (preadv64)
>> +libc_hidden_proto (pwritev)
>> +libc_hidden_proto (pwritev64)
>> #endif
>> #endif
>> diff --git a/manual/llio.texi b/manual/llio.texi
>> index dae3754..404a966 100644
>> --- a/manual/llio.texi
>> +++ b/manual/llio.texi
>> @@ -756,6 +756,115 @@ When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
>> @code{pwritev} and so transparently replaces the 32 bit interface.
>> @end deftypefun
>>
>> +@comment sys/uio.h
>> +@comment GNU
>> +@deftypefun ssize_t preadv2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}, int @var{flags})
>> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
>> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
>> +@c is also MT-Safe since it calls preadv.
>> +
>> +This function is similar to the @code{preadv} function, with the difference
>> +it adds an extra @var{flags} parameter of type @code{int}. The supported
>> +@var{flags} are dependent of the underlying system. For Linux it supports:
>> +
>> +@vtable @code
>> +@item RWF_HIPRI
>> +High priority request. This adds a flag that tells the file system that
>> +this is a high priority request for which it is worth to poll the hardware.
>> +The flag is purely advisory and can be ignored if not supported. The
>> +@var{fd} must be opened using @code{O_DIRECT}.
>> +
>> +@item RWF_DSYNC
>> +Per-IO synchronization as if the file was opened with @code{O_DSYNC} flag.
>> +
>> +@item RWF_SYNC
>> +Per-IO synchronization as if the file was opened with @code{O_SYNC} flag.
>> +@end vtable
>> +
>> +When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
>> +@code{preadv2} function is in fact @code{preadv64v2} and the type
>> +@code{off_t} has 64 bits, which makes it possible to handle files up to
>> +@twoexp{63} bytes in length.
>> +
>> +The return value is a count of bytes (@emph{not} buffers) read, @math{0}
>> +indicating end-of-file, or @math{-1} indicating an error. The possible
>> +errors are the same as in @code{preadv} with the addition of:
>> +
>> +@table @code
>> +
>> +@item EOPNOTSUPP
>> +
>> +@c The default sysdeps/posix code will return it for any flags value
>> +@c different than 0.
>> +An unsupported @var{flags} was used.
>> +
>> +@end table
>> +
>> +@end deftypefun
>> +
>> +@comment unistd.h
>> +@comment GNU
>> +@deftypefun ssize_t preadv64v2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}, int @var{flags})
>> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
>> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
>> +@c is also MT-Safe since it calls preadv.
>> +
>> +This function is similar to the @code{preadv2} function with the difference
>> +is that the @var{offset} parameter is of type @code{off64_t} instead of
>> +@code{off_t}. It makes it possible on 32 bit machines to address
>> +files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The
>> +file descriptor @code{filedes} must be opened using @code{open64} since
>> +otherwise the large offsets possible with @code{off64_t} will lead to
>> +errors with a descriptor in small file mode.
>> +
>> +When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
>> +32 bit machine this function is actually available under the name
>> +@code{preadv2} and so transparently replaces the 32 bit interface.
>> +@end deftypefun
>> +
>> +
>> +@comment sys/uio.h
>> +@comment GNU
>> +@deftypefun ssize_t pwritev2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}, int @var{flags})
>> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
>> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
>> +@c is also MT-Safe since it calls pwritev.
>> +
>> +This function is similar to the @code{pwritev} function, with the difference
>> +it adds an extra @var{flags} parameter of type @code{int}. The supported
>> +@var{flags} are dependent of the underlying system and for Linux it supports
>> +the same ones as for @code{preadv2}.
>> +
>> +When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
>> +@code{pwritev2} function is in fact @code{pwritev64v2} and the type
>> +@code{off_t} has 64 bits, which makes it possible to handle files up to
>> +@twoexp{63} bytes in length.
>> +
>> +The return value is a count of bytes (@emph{not} buffers) write, @math{0}
>> +indicating end-of-file, or @math{-1} indicating an error. The possible
>> +errors are the same as in @code{preadv2}.
>> +@end deftypefun
>> +
>> +@comment unistd.h
>> +@comment GNU
>> +@deftypefun ssize_t pwritev64v2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}, int @var{flags})
>> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
>> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
>> +@c is also MT-Safe since it calls pwritev.
>> +
>> +This function is similar to the @code{pwritev2} function with the difference
>> +is that the @var{offset} parameter is of type @code{off64_t} instead of
>> +@code{off_t}. It makes it possible on 32 bit machines to address
>> +files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The
>> +file descriptor @code{filedes} must be opened using @code{open64} since
>> +otherwise the large offsets possible with @code{off64_t} will lead to
>> +errors with a descriptor in small file mode.
>> +
>> +When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
>> +32 bit machine this function is actually available under the name
>> +@code{pwritev2} and so transparently replaces the 32 bit interface.
>> +@end deftypefun
>> +
>>
>> @node File Position Primitive
>> @section Setting the File Position of a Descriptor
>> diff --git a/misc/Makefile b/misc/Makefile
>> index 622da67..bed46d7 100644
>> --- a/misc/Makefile
>> +++ b/misc/Makefile
>> @@ -39,6 +39,7 @@ headers := sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
>>
>> routines := brk sbrk sstk ioctl \
>> readv writev preadv preadv64 pwritev pwritev64 \
>> + preadv2 preadv64v2 pwritev2 pwritev64v2 \
>> setreuid setregid \
>> seteuid setegid \
>> getpagesize \
>> @@ -79,7 +80,9 @@ gpl2lgpl := error.c error.h
>> tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
>> tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
>> tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 \
>> - tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \
>> + tst-preadvwritev tst-preadvwritev64 tst-preadvwritev2 \
>> + tst-preadvwritev64v2 \
>> + tst-makedev tst-empty \
>> tst-atomic tst-atomic-long
>> tests-static := tst-empty
>>
>> diff --git a/misc/Versions b/misc/Versions
>> index f2c90ff..bafda78 100644
>> --- a/misc/Versions
>> +++ b/misc/Versions
>> @@ -155,6 +155,9 @@ libc {
>> GLIBC_2.25 {
>> gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;
>> }
>> + GLIBC_2.26 {
>> + preadv2; preadv64v2; pwritev2; pwritev64v2;
>> + }
>> GLIBC_PRIVATE {
>> __madvise;
>> __mktemp;
>> diff --git a/misc/preadv2.c b/misc/preadv2.c
>> new file mode 100644
>> index 0000000..a62dcaa
>> --- /dev/null
>> +++ b/misc/preadv2.c
>> @@ -0,0 +1,30 @@
>> +/* Default implementation of preadv2.
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <sys/uio.h>
>> +
>> +/* Same as preadv but with an additional flags argument. */
>> +ssize_t
>> +preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
>> + int flags)
>> +{
>> + __set_errno (ENOSYS);
>> + return -1;
>> +}
>> +
>> +stub_warning (preadv2)
>> diff --git a/misc/preadv64v2.c b/misc/preadv64v2.c
>> new file mode 100644
>> index 0000000..a802c2f
>> --- /dev/null
>> +++ b/misc/preadv64v2.c
>> @@ -0,0 +1,30 @@
>> +/* Default implementation of preadv2 (LFS version).
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <sys/uio.h>
>> +
>> +/* Same as preadv64 but with an addional flag argument. */
>> +ssize_t
>> +preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>> + int flags)
>> +{
>> + __set_errno (ENOSYS);
>> + return -1;
>> +}
>> +
>> +stub_warning (preadv64v2)
>> diff --git a/misc/pwritev2.c b/misc/pwritev2.c
>> new file mode 100644
>> index 0000000..b9e0727
>> --- /dev/null
>> +++ b/misc/pwritev2.c
>> @@ -0,0 +1,30 @@
>> +/* Default implementation of pwritev2.
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <sys/uio.h>
>> +
>> +/* Same as pwritev but with an additional flags argument. */
>> +ssize_t
>> +pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
>> + int flags)
>> +{
>> + __set_errno (ENOSYS);
>> + return -1;
>> +}
>> +
>> +stub_warning (pwritev2)
>> diff --git a/misc/pwritev64v2.c b/misc/pwritev64v2.c
>> new file mode 100644
>> index 0000000..1f874f0
>> --- /dev/null
>> +++ b/misc/pwritev64v2.c
>> @@ -0,0 +1,30 @@
>> +/* Default implementation of pwritev2 (LFS version).
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <sys/uio.h>
>> +
>> +/* Same as preadv64 but with an addional flag argument. */
>> +ssize_t
>> +pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>> + int flags)
>> +{
>> + __set_errno (ENOSYS);
>> + return -1;
>> +}
>> +
>> +stub_warning (pwritev64v2)
>> diff --git a/misc/sys/uio.h b/misc/sys/uio.h
>> index e80f013..66c22f0 100644
>> --- a/misc/sys/uio.h
>> +++ b/misc/sys/uio.h
>> @@ -76,6 +76,7 @@ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
>> __THROW. */
>> extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
>> __off_t __offset) __wur;
>> +
>> # else
>> # ifdef __REDIRECT
>> extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec,
>> @@ -117,6 +118,46 @@ extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count,
>> # endif
>> #endif /* Use misc. */
>>
>> +
>> +#ifdef __USE_GNU
>> +# ifndef __USE_FILE_OFFSET64
>> +/* Same as preadv but with an additional flag argumenti defined at uio.h. */
>> +extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count,
>> + __off_t __offset, int ___flags) __wur;
>> +
>> +/* Same as preadv but with an additional flag argument defined at uio.h. */
>> +extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count,
>> + __off_t __offset, int __flags) __wur;
>> +
>> +# else
>> +# ifdef __REDIRECT
>> +extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec,
>> + int __count, __off64_t __offset,
>> + int __flags),
>> + pwritev64v2) __wur;
>> +extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec,
>> + int __count, __off64_t __offset,
>> + int __flags),
>> + preadv64v2) __wur;
>> +# else
>> +# define preadv2 preadv64v2
>> +# define pwritev2 pwritev64v2
>> +# endif
>> +# endif
>> +
>> +# ifdef __USE_LARGEFILE64
>> +/* Same as preadv but with an additional flag argumenti defined at uio.h. */
>> +extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec,
>> + int __count, __off64_t __offset,
>> + int ___flags) __wur;
>> +
>> +/* Same as preadv but with an additional flag argument defined at uio.h. */
>> +extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev,
>> + int __count, __off64_t __offset,
>> + int __flags) __wur;
>> +# endif
>> +#endif /* Use GNU. */
>> +
>> __END_DECLS
>>
>> #endif /* sys/uio.h */
>> diff --git a/misc/tst-preadvwritev-common.c b/misc/tst-preadvwritev-common.c
>> index 5540dfb..676d495 100644
>> --- a/misc/tst-preadvwritev-common.c
>> +++ b/misc/tst-preadvwritev-common.c
>> @@ -18,6 +18,7 @@
>>
>> #include <stdio.h>
>> #include <stdint.h>
>> +#include <errno.h>
>> #include <string.h>
>> #include <sys/uio.h>
>> #include <sys/stat.h>
>> @@ -39,6 +40,16 @@ do_prepare (int argc, char **argv)
>> }
>> #define PREPARE do_prepare
>>
>> +#ifndef PREADV
>> +# define PREADV(__fd, __iov, __iovcnt, __offset) \
>> + preadv (__fd, __iov, __iovcnt, __offset)
>> +#endif
>> +
>> +#ifndef PWRITEV
>> +# define PWRITEV(__fd, __iov, __iovcnt, __offset) \
>> + pwritev (__fd, __iov, __iovcnt, __offset)
>> +#endif
>> +
>> static int
>> do_test_with_offset (off_t offset)
>> {
>> @@ -58,13 +69,13 @@ do_test_with_offset (off_t offset)
>> iov[1].iov_base = buf2;
>> iov[1].iov_len = sizeof buf2;
>>
>> - ret = pwritev (temp_fd, iov, 2, offset);
>> + ret = PWRITEV (temp_fd, iov, 2, offset);
>> if (ret == -1)
>> FAIL_RET ("first pwritev returned -1");
>> if (ret != (sizeof buf1 + sizeof buf2))
>> FAIL_RET ("first pwritev returned an unexpected value");
>>
>> - ret = pwritev (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset);
>> + ret = PWRITEV (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset);
>> if (ret == -1)
>> FAIL_RET ("second pwritev returned -1");
>> if (ret != (sizeof buf1 + sizeof buf2))
>> @@ -82,7 +93,7 @@ do_test_with_offset (off_t offset)
>> iov[1].iov_len = sizeof buf4;
>>
>> /* Now read two buffer with 32 and 64 bytes respectively. */
>> - ret = preadv (temp_fd, iov, 2, offset);
>> + ret = PREADV (temp_fd, iov, 2, offset);
>> if (ret == -1)
>> FAIL_RET ("first preadv returned -1");
>> if (ret != (sizeof buf3 + sizeof buf4))
>> @@ -93,7 +104,7 @@ do_test_with_offset (off_t offset)
>> if (memcmp (buf2, buf4, sizeof buf2) != 0)
>> FAIL_RET ("second buffer from first preadv different than expected");
>>
>> - ret = preadv (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset);
>> + ret = PREADV (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset);
>> if (ret == -1)
>> FAIL_RET ("second preadv returned -1");
>> if (ret != (sizeof buf3 + sizeof buf4))
>> diff --git a/misc/tst-preadvwritev2.c b/misc/tst-preadvwritev2.c
>> new file mode 100644
>> index 0000000..cf36272
>> --- /dev/null
>> +++ b/misc/tst-preadvwritev2.c
>> @@ -0,0 +1,31 @@
>> +/* Tests for preadv2 and pwritev2.
>> + Copyright (C) 2016-2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#define PREADV(__fd, __iov, __iovcnt, __offset) \
>> + preadv2 (__fd, __iov, __iovcnt, __offset, 0)
>> +
>> +#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
>> + pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
>> +
>> +#include "tst-preadvwritev-common.c"
>> +
>> +static int
>> +do_test (void)
>> +{
>> + return do_test_with_offset (0);
>> +}
>> diff --git a/misc/tst-preadvwritev64v2.c b/misc/tst-preadvwritev64v2.c
>> new file mode 100644
>> index 0000000..8d0c48e
>> --- /dev/null
>> +++ b/misc/tst-preadvwritev64v2.c
>> @@ -0,0 +1,33 @@
>> +/* Tests for preadv2 and pwritev2 (LFS version).
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#define _FILE_OFFSET_BITS 64
>> +
>> +#define PREADV(__fd, __iov, __iovcnt, __offset) \
>> + preadv2 (__fd, __iov, __iovcnt, __offset, 0)
>> +
>> +#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
>> + pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
>> +
>> +#include "tst-preadvwritev-common.c"
>> +
>> +static int
>> +do_test (void)
>> +{
>> + return do_test_with_offset (0);
>> +}
>> diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c
>> index e66961f..7a560a1 100644
>> --- a/nptl/tst-cancel4.c
>> +++ b/nptl/tst-cancel4.c
>> @@ -1079,6 +1079,75 @@ tf_pwritev (void *arg)
>> }
>>
>> static void *
>> +tf_pwritev2 (void *arg)
>> +{
>> + int fd;
>> +
>> + if (arg == NULL)
>> + /* XXX If somebody can provide a portable test case in which pwritev2
>> + blocks we can enable this test to run in both rounds. */
>> + abort ();
>> +
>> + errno = 0;
>> +
>> + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
>> + tempfd = fd = mkstemp (fname);
>> + if (fd == -1)
>> + FAIL_EXIT1 ("mkstemp: %m");
>> + unlink (fname);
>> +
>> + xpthread_barrier_wait (&b2);
>> +
>> + xpthread_barrier_wait (&b2);
>> +
>> + ssize_t s;
>> + pthread_cleanup_push (cl, NULL);
>> +
>> + char buf[WRITE_BUFFER_SIZE];
>> + memset (buf, '\0', sizeof (buf));
>> + struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
>> + s = pwritev2 (fd, iov, 1, 0, 0);
>> +
>> + pthread_cleanup_pop (0);
>> +
>> + FAIL_EXIT1 ("pwritev2 returns with %zd", s);
>> +}
>> +
>> +static void *
>> +tf_preadv2 (void *arg)
>> +{
>> + int fd;
>> +
>> + if (arg == NULL)
>> + /* XXX If somebody can provide a portable test case in which preadv2
>> + blocks we can enable this test to run in both rounds. */
>> + abort ();
>> +
>> + errno = 0;
>> +
>> + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
>> + tempfd = fd = mkstemp (fname);
>> + if (fd == -1)
>> + FAIL_EXIT1 ("mkstemp failed: %m");
>> + unlink (fname);
>> +
>> + xpthread_barrier_wait (&b2);
>> +
>> + xpthread_barrier_wait (&b2);
>> +
>> + ssize_t s;
>> + pthread_cleanup_push (cl, NULL);
>> +
>> + char buf[100];
>> + struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
>> + s = preadv2 (fd, iov, 1, 0, 0);
>> +
>> + pthread_cleanup_pop (0);
>> +
>> + FAIL_EXIT1 ("preadv2 returns with %zd", s);
>> +}
>> +
>> +static void *
>> tf_fsync (void *arg)
>> {
>> if (arg == NULL)
>> @@ -1473,7 +1542,9 @@ struct cancel_tests tests[] =
>> ADD_TEST (recvfrom, 2, 0),
>> ADD_TEST (recvmsg, 2, 0),
>> ADD_TEST (preadv, 2, 1),
>> + ADD_TEST (preadv2, 2, 1),
>> ADD_TEST (pwritev, 2, 1),
>> + ADD_TEST (pwritev2, 2, 1),
>> ADD_TEST (open, 2, 1),
>> ADD_TEST (close, 2, 1),
>> ADD_TEST (pread, 2, 1),
>> diff --git a/sysdeps/posix/preadv2.c b/sysdeps/posix/preadv2.c
>> new file mode 100644
>> index 0000000..2a7cf11
>> --- /dev/null
>> +++ b/sysdeps/posix/preadv2.c
>> @@ -0,0 +1,38 @@
>> +/* Generic version of preadv2.
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <unistd.h>
>> +#include <sys/uio.h>
>> +
>> +#ifndef __OFF_T_MATCHES_OFF64_T
>> +
>> +/* Since we define no flags for preadv2 just route to preadv. */
>> +ssize_t
>> +preadv2 (int fd, const struct iovec *vector, int count, OFF_T offset,
>> + int flags)
>> +{
>> + if (flags != 0)
>> + {
>> + __set_errno (EOPNOTSUPP);
>> + return -1;
>> + }
>> +
>> + return preadv (fd, vector, count, offset);
>> +}
>> +
>> +#endif
>> diff --git a/sysdeps/posix/preadv64v2.c b/sysdeps/posix/preadv64v2.c
>> new file mode 100644
>> index 0000000..e084f3f
>> --- /dev/null
>> +++ b/sysdeps/posix/preadv64v2.c
>> @@ -0,0 +1,37 @@
>> +/* Generic version of preadv2.
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <unistd.>
>> +#include <sys/uio.h>
>> +
>> +ssize_t
>> +preadv64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
>> + int flags)
>> +{
>> + if (flags != 0)
>> + {
>> + __set_errno (EOPNOTSUPP);
>> + return -1;
>> + }
>> +
>> + return preadv64 (fd, vector, count, offset);
>> +}
>> +
>> +#ifdef __OFF_T_MATCHES_OFF64_T
>> +strong_alias (preadv64v2, preadv2)
>> +#endif
>> diff --git a/sysdeps/posix/pwritev2.c b/sysdeps/posix/pwritev2.c
>> new file mode 100644
>> index 0000000..5b7650c
>> --- /dev/null
>> +++ b/sysdeps/posix/pwritev2.c
>> @@ -0,0 +1,38 @@
>> +/* Generic version of pwritev2.
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <unistd.h>
>> +#include <sys/uio.h>
>> +
>> +#ifndef __OFF_T_MATCHES_OFF64_T
>> +
>> +/* Since we define no flags for pwritev2 just route to pwritev. */
>> +ssize_t
>> +pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset,
>> + int flags)
>> +{
>> + if (flags != 0)
>> + {
>> + __set_errno (EOPNOTSUPP);
>> + return -1;
>> + }
>> +
>> + return pwritev (fd, vector, count, offset);
>> +}
>> +
>> +#endif
>> diff --git a/sysdeps/posix/pwritev64v2.c b/sysdeps/posix/pwritev64v2.c
>> new file mode 100644
>> index 0000000..d9727b9
>> --- /dev/null
>> +++ b/sysdeps/posix/pwritev64v2.c
>> @@ -0,0 +1,38 @@
>> +/* Generic version of pwritev2.
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <unistd.h>
>> +#include <sys/uio.h>
>> +
>> +/* Since we define no flags for pwritev2 just route to pwritev. */
>> +ssize_t
>> +pwritev64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
>> + int flags)
>> +{
>> + if (flags != 0)
>> + {
>> + __set_errno (EOPNOTSUPP);
>> + return -1;
>> + }
>> +
>> + return pwritev64 (fd, vector, count, offset);
>> +}
>> +
>> +#ifdef __OFF_T_MATCHES_OFF64_T
>> +strong_alias (pwritev64v2, pwritev2)
>> +#endif
>> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
>> index 58d768c..296f2a5 100644
>> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
>> @@ -2097,3 +2097,8 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
>> index 906050d..8006e72 100644
>> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
>> @@ -2008,6 +2008,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
>> index 66112dd..29f9688 100644
>> --- a/sysdeps/unix/sysv/linux/arm/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
>> @@ -98,6 +98,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.4 GLIBC_2.4 A
>> GLIBC_2.4 _Exit F
>> GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>> diff --git a/sysdeps/unix/sysv/linux/bits/uio.h b/sysdeps/unix/sysv/linux/bits/uio.h
>> index 1583f04..d5701f8 100644
>> --- a/sysdeps/unix/sysv/linux/bits/uio.h
>> +++ b/sysdeps/unix/sysv/linux/bits/uio.h
>> @@ -69,4 +69,10 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
>> __END_DECLS
>>
>> # endif
>> +
>> +/* Flags for preadv2/pwritev2: */
>> +#define RWF_HIPRI 0x00000001 /* High priority request. */
>> +#define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC. */
>> +#define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */
>> +
>> #endif
>> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
>> index 3ddadd2..e9cfbaf 100644
>> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
>> @@ -1862,6 +1862,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
>> index 977ab90..c6ad3c3 100644
>> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
>> @@ -2020,6 +2020,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
>> index c7edb9a..d0055a2 100644
>> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
>> @@ -1884,6 +1884,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
>> index b981466..8ee1af7 100644
>> --- a/sysdeps/unix/sysv/linux/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
>> @@ -137,3 +137,8 @@
>> /* Support for SysV IPC through wired syscalls. All supported architectures
>> either support ipc syscall and/or all the ipc correspondent syscalls. */
>> #define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1
>> +
>> +/* Support for p{read,write}v2 was added in 4.6. However Linux default
>> + implementation does not assume the __ASSUME_* and instead use a fallback
>> + implementation based on p{read,write}v and returning an error for
>> + non supported flags. */
>> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
>> index 450be4e..3777676 100644
>> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
>> @@ -99,6 +99,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.4 GLIBC_2.4 A
>> GLIBC_2.4 _Exit F
>> GLIBC_2.4 _IO_2_1_stderr_ D 0x98
>> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
>> index 9e016bd..8b1f80c 100644
>> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
>> @@ -1976,6 +1976,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
>> index 1a455be..d4db9a8 100644
>> --- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
>> @@ -2097,3 +2097,8 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
>> index 8eb5e66..f430bdb 100644
>> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
>> @@ -1951,6 +1951,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
>> index 416d9ac..a4dca19 100644
>> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
>> @@ -1949,6 +1949,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
>> index f4949e5..0814fa8 100644
>> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
>> @@ -1947,6 +1947,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
>> index c7375ae..a0bdeff 100644
>> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
>> @@ -1942,6 +1942,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
>> index 724a0e3..b201290 100644
>> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
>> @@ -2138,3 +2138,8 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>> index 2dc32b6..6e7ff24 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>> @@ -1980,6 +1980,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>> index 5658109..19c7c7d 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>> @@ -1985,6 +1985,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
>> index c761221..e94ce38 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
>> @@ -2185,3 +2185,8 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
>> index 265c769..f3daa33 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
>> @@ -99,6 +99,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 _Exit F
>> GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
>> diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c
>> index 7d971cc..ecabc8c 100644
>> --- a/sysdeps/unix/sysv/linux/preadv.c
>> +++ b/sysdeps/unix/sysv/linux/preadv.c
>> @@ -50,4 +50,6 @@ preadv (int fd, const struct iovec *vector, int count, off_t offset)
>> # define OFF_T off_t
>> # include <sysdeps/posix/preadv_common.c>
>> # endif /* __ASSUME_PREADV */
>> +
>> +libc_hidden_def (preadv)
>> #endif
>> diff --git a/sysdeps/unix/sysv/linux/preadv2.c b/sysdeps/unix/sysv/linux/preadv2.c
>> new file mode 100644
>> index 0000000..11fe85e
>> --- /dev/null
>> +++ b/sysdeps/unix/sysv/linux/preadv2.c
>> @@ -0,0 +1,55 @@
>> +/* Linux implementation of preadv2.
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <sys/uio.h>
>> +#include <sysdep-cancel.h>
>> +
>> +#ifndef __OFF_T_MATCHES_OFF64_T
>> +
>> +# if !defined (__NR_preadv2) && defined (__NR_pread64v2)
>> +# define __NR_preadv2 __NR_pread64v2
>> +# endif
>> +
>> +ssize_t
>> +preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
>> + int flags)
>> +{
>> +# ifdef __NR_preadv2
>> + ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
>> + LO_HI_LONG (offset), flags);
>> + if (result >= 0 || errno != ENOSYS)
>> + return result;
>> +# endif
>> + /* Trying to emulate the preadv2 syscall flags is troublesome:
>> +
>> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
>> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
>> + fcntl are silently ignored).
>> +
>> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>> + semantic not provided by any other flag (O_NONBLOCK for instance). */
>> +
>> + if (flags != 0)
>> + {
>> + __set_errno (EOPNOTSUPP);
>> + return -1;
>> + }
>> + return preadv (fd, vector, count, offset);
>> +}
>> +
>> +#endif
>> diff --git a/sysdeps/unix/sysv/linux/preadv64.c b/sysdeps/unix/sysv/linux/preadv64.c
>> index 66daa74..c96b214 100644
>> --- a/sysdeps/unix/sysv/linux/preadv64.c
>> +++ b/sysdeps/unix/sysv/linux/preadv64.c
>> @@ -48,7 +48,9 @@ preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
>> # define OFF_T off64_t
>> # include <sysdeps/posix/preadv_common.c>
>> #endif
>> +libc_hidden_def (preadv64)
>>
>> #ifdef __OFF_T_MATCHES_OFF64_T
>> strong_alias (preadv64, preadv)
>> +libc_hidden_def (preadv)
>> #endif
>> diff --git a/sysdeps/unix/sysv/linux/preadv64v2.c b/sysdeps/unix/sysv/linux/preadv64v2.c
>> new file mode 100644
>> index 0000000..9d7f8c9
>> --- /dev/null
>> +++ b/sysdeps/unix/sysv/linux/preadv64v2.c
>> @@ -0,0 +1,55 @@
>> +/* Linux implementation of preadv2 (LFS version).
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <sys/uio.h>
>> +#include <sysdep-cancel.h>
>> +
>> +#if !defined(__NR_preadv64v2) && defined(__NR_preadv2)
>> +# define __NR_preadv64v2 __NR_preadv2
>> +#endif
>> +
>> +ssize_t
>> +preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>> + int flags)
>> +{
>> +#ifdef __NR_preadv64v2
>> + ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
>> + LO_HI_LONG (offset), flags);
>> + if (result >= 0 || errno != ENOSYS)
>> + return result;
>> +#endif
>> + /* Trying to emulate the preadv2 syscall flags is troublesome:
>> +
>> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
>> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
>> + fcntl are silently ignored).
>> +
>> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>> + semantic not provided by any other flag (O_NONBLOCK for instance). */
>> +
>> + if (flags != 0)
>> + {
>> + __set_errno (EOPNOTSUPP);
>> + return -1;
>> + }
>> + return preadv64 (fd, vector, count, offset);
>> +}
>> +
>> +#ifdef __OFF_T_MATCHES_OFF64_T
>> +strong_alias (preadv64v2, preadv2)
>> +#endif
>> diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
>> index 57e5d20..71959c0 100644
>> --- a/sysdeps/unix/sysv/linux/pwrite64.c
>> +++ b/sysdeps/unix/sysv/linux/pwrite64.c
>> @@ -28,6 +28,7 @@ __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
>> {
>> return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL64_PRW (offset));
>> }
>> +
>> weak_alias (__libc_pwrite64, __pwrite64)
>> libc_hidden_weak (__pwrite64)
>> weak_alias (__libc_pwrite64, pwrite64)
>> diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c
>> index ce02996..7545cb3 100644
>> --- a/sysdeps/unix/sysv/linux/pwritev.c
>> +++ b/sysdeps/unix/sysv/linux/pwritev.c
>> @@ -50,4 +50,6 @@ pwritev (int fd, const struct iovec *vector, int count, off_t offset)
>> # define OFF_T off_t
>> # include <sysdeps/posix/pwritev_common.c>
>> # endif /* __ASSUME_PREADV */
>> +
>> +libc_hidden_def (pwritev)
>> #endif
>> diff --git a/sysdeps/unix/sysv/linux/pwritev2.c b/sysdeps/unix/sysv/linux/pwritev2.c
>> new file mode 100644
>> index 0000000..72f0471
>> --- /dev/null
>> +++ b/sysdeps/unix/sysv/linux/pwritev2.c
>> @@ -0,0 +1,51 @@
>> +/* Linux implementation of pwritev2.
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <sys/uio.h>
>> +#include <sysdep-cancel.h>
>> +
>> +#ifndef __OFF_T_MATCHES_OFF64_T
>> +
>> +ssize_t
>> +pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
>> + int flags)
>> +{
>> +# ifdef __NR_pwritev2
>> + ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
>> + LO_HI_LONG (offset), flags);
>> + if (result >= 0 || errno != ENOSYS)
>> + return result;
>> +# endif
>> + /* Trying to emulate the pwritev2 syscall flags is troublesome:
>> +
>> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
>> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
>> + fcntl are silently ignored).
>> +
>> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>> + semantic not provided by any other flag (O_NONBLOCK for instance). */
>> +
>> + if (flags != 0)
>> + {
>> + __set_errno (EOPNOTSUPP);
>> + return -1;
>> + }
>> + return pwritev (fd, vector, count, offset);
>> +}
>> +
>> +#endif
>> diff --git a/sysdeps/unix/sysv/linux/pwritev64.c b/sysdeps/unix/sysv/linux/pwritev64.c
>> index 45fb90b..9dc4e55 100644
>> --- a/sysdeps/unix/sysv/linux/pwritev64.c
>> +++ b/sysdeps/unix/sysv/linux/pwritev64.c
>> @@ -48,7 +48,9 @@ pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
>> # define OFF_T off64_t
>> # include <sysdeps/posix/pwritev_common.c>
>> #endif
>> +libc_hidden_def (pwritev64)
>>
>> #ifdef __OFF_T_MATCHES_OFF64_T
>> strong_alias (pwritev64, pwritev)
>> +libc_hidden_def (pwritev)
>> #endif
>> diff --git a/sysdeps/unix/sysv/linux/pwritev64v2.c b/sysdeps/unix/sysv/linux/pwritev64v2.c
>> new file mode 100644
>> index 0000000..def9a0b
>> --- /dev/null
>> +++ b/sysdeps/unix/sysv/linux/pwritev64v2.c
>> @@ -0,0 +1,55 @@
>> +/* Linux implementation of pwritev2 (LFS version).
>> + Copyright (C) 2017 Free Software Foundation, Inc.
>> + This file is part of the GNU C Library.
>> +
>> + The GNU C Library is free software; you can redistribute it and/or
>> + modify it under the terms of the GNU Lesser General Public
>> + License as published by the Free Software Foundation; either
>> + version 2.1 of the License, or (at your option) any later version.
>> +
>> + The GNU C Library is distributed in the hope that it will be useful,
>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + Lesser General Public License for more details.
>> +
>> + You should have received a copy of the GNU Lesser General Public
>> + License along with the GNU C Library; if not, see
>> + <http://www.gnu.org/licenses/>. */
>> +
>> +#include <sys/uio.h>
>> +#include <sysdep-cancel.h>
>> +
>> +#if !defined(__NR_pwritev64v2) && defined(__NR_pwritev2)
>> +# define __NR_pwritev64v2 __NR_pwritev2
>> +#endif
>> +
>> +ssize_t
>> +pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>> + int flags)
>> +{
>> +#ifdef __NR_pwritev64v2
>> + ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
>> + LO_HI_LONG (offset), flags);
>> + if (result >= 0 || errno != ENOSYS)
>> + return result;
>> +#endif
>> + /* Trying to emulate the pwritev2 syscall flags is troublesome:
>> +
>> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
>> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
>> + fcntl are silently ignored).
>> +
>> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>> + semantic not provided by any other flag (O_NONBLOCK for instance). */
>> +
>> + if (flags != 0)
>> + {
>> + __set_errno (EOPNOTSUPP);
>> + return -1;
>> + }
>> + return pwritev64 (fd, vector, count, offset);
>> +}
>> +
>> +#ifdef __OFF_T_MATCHES_OFF64_T
>> +strong_alias (pwritev64v2, pwritev2)
>> +#endif
>> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
>> index ed1b6bf..eb9e72f 100644
>> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
>> @@ -1980,6 +1980,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
>> index 2e75d29..1402959 100644
>> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
>> @@ -1881,6 +1881,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
>> index bd74c0c..e9eefcb 100644
>> --- a/sysdeps/unix/sysv/linux/sh/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
>> @@ -1866,6 +1866,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
>> index 5584838..967699e 100644
>> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
>> @@ -1972,6 +1972,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
>> index efedbe2..9dd938a 100644
>> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
>> @@ -1910,6 +1910,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
>> index ffd988a..68c9887 100644
>> --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
>> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
>> index f0c13ce..97aa0f7 100644
>> --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
>> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> diff --git a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
>> index ffd988a..68c9887 100644
>> --- a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
>> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
>> index f57004c..2032659 100644
>> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
>> @@ -1861,6 +1861,11 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>> GLIBC_2.3 GLIBC_2.3 A
>> GLIBC_2.3 __ctype_b_loc F
>> GLIBC_2.3 __ctype_tolower_loc F
>> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
>> index 05629e1..11a278c 100644
>> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
>> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
>> GLIBC_2.25 strfromd F
>> GLIBC_2.25 strfromf F
>> GLIBC_2.25 strfroml F
>> +GLIBC_2.26 GLIBC_2.26 A
>> +GLIBC_2.26 preadv2 F
>> +GLIBC_2.26 preadv64v2 F
>> +GLIBC_2.26 pwritev2 F
>> +GLIBC_2.26 pwritev64v2 F
>>
I will commit this shortly.
On 30/05/2017 11:18, Adhemerval Zanella wrote:
> Ping x2. Any impeding issue about this patch? Otherwise I would like to push it.
>
> On 11/05/2017 16:01, Adhemerval Zanella wrote:
>> Ping.
>>
>> On 04/05/2017 09:43, Adhemerval Zanella wrote:
>>> Change from previous version:
>>>
>>> * Add unsupported flag check for Linux implementation.
>>>
>>> * Unsupported/invalid flags now return EOPNOTSUPP instead of
>>> EINVAL.
>>>
>>> * Add comment about preadv2 and pwritev2 support on kernel-features.h.
>>>
>>> * Add NEWS entry.
>>>
>>> * Fix typo in documentation.
>>>
>>> --
>>>
>>> This patch adds support of preadv2 and pwritev2 which are similar to
>>> preadv/pwritev but adds an extra flag argument. As for preadv/pwritev
>>> both interfaces are added a non-standard standard GNU API.
>>>
>>> On default 'posix' implementation trying to emulate the Linux supported
>>> flags is troublesome:
>>>
>>> * We can not temporary change the file state of the O_DSYNC and O_SYNC
>>> flags to emulate RWF_{D}SYNC (attempts to change the state of using
>>> fcntl are silently ignored).
>>>
>>> * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>>> semantic not provided by any other flag (O_NONBLOCK for instance).
>>>
>>> So default sysdeps/posix implementations fails with EINVAL for any non
>>> supported flag (which are none currently) calls generic preadv/pwritev.
>>> Basically, it supports only preadv2 called as preadv (with flags sets
>>> to 0).
>>>
>>> The Linux one uses the preadv2/pwritev2 syscall if defined, otherwise it
>>> call preadv/writev. Instead of using the previous __ASSUME_* to
>>> unconditionally issue the syscall (and avoid building the fallback routine),
>>> it call pread/write if the preadv2/pwritev2 syscalls fails. The idea
>>> is just avoid adding another __ASSUME_* and checking each architecture
>>> on every kernel bump and simplify code conditionals.
>>>
>>> Checked on x86_64-linux-gnu and on i686-linux-gnu and a check with
>>> run-built-tests=no on aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
>>> ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips{64,64n32}-linux-gnu,
>>> nios2-linux-gnu, powerpc{64,64le}-linux-gnu, s390{x}-linux-gnu,
>>> sparc{64,v9}-linux-gnu, tile{gx,pro}-linux-gnu, and sh4-linux-gnu (all using
>>> gcc 6.3).
>>>
>>> * NEWS: Add note about pwritev2 and preadv2 inclusion.
>>> * misc/Makefile (routines): Add preadv2, preadv64v2, pwritev2, and
>>> pwritev64v2.
>>> (tests): Add tst-preadvwritev2 and tst-preadvwritev64v2.
>>> * misc/Versions (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, and
>>> pwritev64v2.
>>> * misc/preadv2.c: New file.
>>> * misc/preadv64v2.c: Likewise.
>>> * misc/pwritev2.c: Likewise.
>>> * misc/pwritev64v2.c: Likewise.
>>> * misc/tst-preadvwritev2.c: Likewise.
>>> * misc/tst-preadvwritev64v2.c: Likewise.
>>> * manual/llio.texi: Add preadv2 and pwritev2 documentation.
>>> * misc/sys/uio.h [__USE_GNU && !__USE_FILE_OFFSET64] (preadv2): New
>>> prototype.
>>> [__USE_GNU && !__USE_FILE_OFFSET64] (pwritev2): Likewise.
>>> [__USE_GNU && __USE_FILE_OFFSET64] (preadv64v2): Likewise.
>>> [__USE_GNU && __USE_FILE_OFFSET64] (pwritev64v2): Likewise.
>>> * misc/tst-preadvwritev-common.c (PREADV): Define if not defined.
>>> (PWRITEV): Likewise.
>>> (do_test_with_offset): Use PREADV and PWRITEV macros and check for
>>> ENOSYS.
>>> * nptl/tst-cancel4.c (tf_pwritev2): New test.
>>> (tf_preadv2): Likewise.
>>> (tf_fsync): Add tf_pwritev2 and tf_preadv2.
>>> * sysdeps/posix/preadv2.c: Likewise.
>>> * sysdeps/posix/preadv64v2.c: Likewise.
>>> * sysdeps/posix/pwritev2.c: Likewise.
>>> * sysdeps/posix/pwritev64v2.c: Likewise.
>>> * sysdeps/unix/sysv/linux/kernel-features.h: Add comment for syscall
>>> support in kernel.
>>> * sysdeps/unix/sysv/linux/preadv2.c: Likewise.
>>> * sysdeps/unix/sysv/linux/preadv64v2.c: Likewise.
>>> * sysdeps/unix/sysv/linux/pwritev2.c: Likewise.
>>> * sysdeps/unix/sysv/linux/pwritev64v2.c: Likewise.
>>> * sysdeps/unix/sysv/linux/preadv.c (preadv): Add libc_hidden_def.
>>> * sysdeps/unix/sysv/linux/preadv64.c (preadv64): Likewise.
>>> * sysdeps/unix/sysv/linux/pwritev.c (pwritev): Likewise.
>>> * sysdeps/unix/sysv/linux/pwritev64.c (pwritev64): Likewise.
>>> * sysdeps/unix/sysv/linux/bits/uio.h: Add supported preadv2/pwritev2
>>> support flags on Linux.
>>> * sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.26): Add
>>> preadv2, preadv64v2, pwritev2, pwritev64v2.
>>> * sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>>> (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>>> (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
>>> (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.26): Likewise.
>>> * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/sysv/linux/tile/tilegx/tilegx32/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/sysv/linux/tile/tilegx/tilegx64/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.26):
>>> Likewise.
>>> ---
>>> ChangeLog | 91 +++++++++++++++++
>>> NEWS | 7 ++
>>> include/sys/uio.h | 6 ++
>>> manual/llio.texi | 109 +++++++++++++++++++++
>>> misc/Makefile | 5 +-
>>> misc/Versions | 3 +
>>> misc/preadv2.c | 30 ++++++
>>> misc/preadv64v2.c | 30 ++++++
>>> misc/pwritev2.c | 30 ++++++
>>> misc/pwritev64v2.c | 30 ++++++
>>> misc/sys/uio.h | 41 ++++++++
>>> misc/tst-preadvwritev-common.c | 19 +++-
>>> misc/tst-preadvwritev2.c | 31 ++++++
>>> misc/tst-preadvwritev64v2.c | 33 +++++++
>>> nptl/tst-cancel4.c | 71 ++++++++++++++
>>> sysdeps/posix/preadv2.c | 38 +++++++
>>> sysdeps/posix/preadv64v2.c | 37 +++++++
>>> sysdeps/posix/pwritev2.c | 38 +++++++
>>> sysdeps/posix/pwritev64v2.c | 38 +++++++
>>> sysdeps/unix/sysv/linux/aarch64/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/alpha/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/arm/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/bits/uio.h | 6 ++
>>> sysdeps/unix/sysv/linux/hppa/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/i386/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/ia64/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/kernel-features.h | 5 +
>>> sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/microblaze/libc.abilist | 5 +
>>> .../unix/sysv/linux/mips/mips32/fpu/libc.abilist | 5 +
>>> .../unix/sysv/linux/mips/mips32/nofpu/libc.abilist | 5 +
>>> .../unix/sysv/linux/mips/mips64/n32/libc.abilist | 5 +
>>> .../unix/sysv/linux/mips/mips64/n64/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/nios2/libc.abilist | 5 +
>>> .../sysv/linux/powerpc/powerpc32/fpu/libc.abilist | 5 +
>>> .../linux/powerpc/powerpc32/nofpu/libc.abilist | 5 +
>>> .../sysv/linux/powerpc/powerpc64/libc-le.abilist | 5 +
>>> .../unix/sysv/linux/powerpc/powerpc64/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/preadv.c | 2 +
>>> sysdeps/unix/sysv/linux/preadv2.c | 55 +++++++++++
>>> sysdeps/unix/sysv/linux/preadv64.c | 2 +
>>> sysdeps/unix/sysv/linux/preadv64v2.c | 55 +++++++++++
>>> sysdeps/unix/sysv/linux/pwrite64.c | 1 +
>>> sysdeps/unix/sysv/linux/pwritev.c | 2 +
>>> sysdeps/unix/sysv/linux/pwritev2.c | 51 ++++++++++
>>> sysdeps/unix/sysv/linux/pwritev64.c | 2 +
>>> sysdeps/unix/sysv/linux/pwritev64v2.c | 55 +++++++++++
>>> sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/sh/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist | 5 +
>>> .../sysv/linux/tile/tilegx/tilegx32/libc.abilist | 5 +
>>> .../sysv/linux/tile/tilegx/tilegx64/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/x86_64/64/libc.abilist | 5 +
>>> sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist | 5 +
>>> 58 files changed, 1058 insertions(+), 5 deletions(-)
>>> create mode 100644 misc/preadv2.c
>>> create mode 100644 misc/preadv64v2.c
>>> create mode 100644 misc/pwritev2.c
>>> create mode 100644 misc/pwritev64v2.c
>>> create mode 100644 misc/tst-preadvwritev2.c
>>> create mode 100644 misc/tst-preadvwritev64v2.c
>>> create mode 100644 sysdeps/posix/preadv2.c
>>> create mode 100644 sysdeps/posix/preadv64v2.c
>>> create mode 100644 sysdeps/posix/pwritev2.c
>>> create mode 100644 sysdeps/posix/pwritev64v2.c
>>> create mode 100644 sysdeps/unix/sysv/linux/preadv2.c
>>> create mode 100644 sysdeps/unix/sysv/linux/preadv64v2.c
>>> create mode 100644 sysdeps/unix/sysv/linux/pwritev2.c
>>> create mode 100644 sysdeps/unix/sysv/linux/pwritev64v2.c
>>>
>>> diff --git a/NEWS b/NEWS
>>> index 5558ca3..afad4b1 100644
>>> --- a/NEWS
>>> +++ b/NEWS
>>> @@ -57,6 +57,13 @@ Version 2.26
>>> be added on next major revision of POSIX, so current support is enabled
>>> with _GNU_SOURCE.
>>>
>>> +* New preadv2 and pwritev2 are added to libc. They are Linux extensions to
>>> + preadv and pwritev with an additional flag argument where it is possible
>>> + to set high priority or use O_DSYNC or O_SYNC for an specific IO operation.
>>> + For complete support it requires Linux kernel version 4.6, otherwise a
>>> + compat implementation will be used (which refuses all flags and routes it
>>> + to preadv or pwritev).
>>> +
>>> Security related changes:
>>>
>>> * The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes,
>>> diff --git a/include/sys/uio.h b/include/sys/uio.h
>>> index f44ce18..20860bf 100644
>>> --- a/include/sys/uio.h
>>> +++ b/include/sys/uio.h
>>> @@ -7,5 +7,11 @@ extern ssize_t __readv (int __fd, const struct iovec *__iovec,
>>> int __count);
>>> extern ssize_t __writev (int __fd, const struct iovec *__iovec,
>>> int __count);
>>> +
>>> +/* Used for p{read,write}{v64}v2 implementation. */
>>> +libc_hidden_proto (preadv)
>>> +libc_hidden_proto (preadv64)
>>> +libc_hidden_proto (pwritev)
>>> +libc_hidden_proto (pwritev64)
>>> #endif
>>> #endif
>>> diff --git a/manual/llio.texi b/manual/llio.texi
>>> index dae3754..404a966 100644
>>> --- a/manual/llio.texi
>>> +++ b/manual/llio.texi
>>> @@ -756,6 +756,115 @@ When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
>>> @code{pwritev} and so transparently replaces the 32 bit interface.
>>> @end deftypefun
>>>
>>> +@comment sys/uio.h
>>> +@comment GNU
>>> +@deftypefun ssize_t preadv2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}, int @var{flags})
>>> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
>>> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
>>> +@c is also MT-Safe since it calls preadv.
>>> +
>>> +This function is similar to the @code{preadv} function, with the difference
>>> +it adds an extra @var{flags} parameter of type @code{int}. The supported
>>> +@var{flags} are dependent of the underlying system. For Linux it supports:
>>> +
>>> +@vtable @code
>>> +@item RWF_HIPRI
>>> +High priority request. This adds a flag that tells the file system that
>>> +this is a high priority request for which it is worth to poll the hardware.
>>> +The flag is purely advisory and can be ignored if not supported. The
>>> +@var{fd} must be opened using @code{O_DIRECT}.
>>> +
>>> +@item RWF_DSYNC
>>> +Per-IO synchronization as if the file was opened with @code{O_DSYNC} flag.
>>> +
>>> +@item RWF_SYNC
>>> +Per-IO synchronization as if the file was opened with @code{O_SYNC} flag.
>>> +@end vtable
>>> +
>>> +When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
>>> +@code{preadv2} function is in fact @code{preadv64v2} and the type
>>> +@code{off_t} has 64 bits, which makes it possible to handle files up to
>>> +@twoexp{63} bytes in length.
>>> +
>>> +The return value is a count of bytes (@emph{not} buffers) read, @math{0}
>>> +indicating end-of-file, or @math{-1} indicating an error. The possible
>>> +errors are the same as in @code{preadv} with the addition of:
>>> +
>>> +@table @code
>>> +
>>> +@item EOPNOTSUPP
>>> +
>>> +@c The default sysdeps/posix code will return it for any flags value
>>> +@c different than 0.
>>> +An unsupported @var{flags} was used.
>>> +
>>> +@end table
>>> +
>>> +@end deftypefun
>>> +
>>> +@comment unistd.h
>>> +@comment GNU
>>> +@deftypefun ssize_t preadv64v2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}, int @var{flags})
>>> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
>>> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
>>> +@c is also MT-Safe since it calls preadv.
>>> +
>>> +This function is similar to the @code{preadv2} function with the difference
>>> +is that the @var{offset} parameter is of type @code{off64_t} instead of
>>> +@code{off_t}. It makes it possible on 32 bit machines to address
>>> +files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The
>>> +file descriptor @code{filedes} must be opened using @code{open64} since
>>> +otherwise the large offsets possible with @code{off64_t} will lead to
>>> +errors with a descriptor in small file mode.
>>> +
>>> +When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
>>> +32 bit machine this function is actually available under the name
>>> +@code{preadv2} and so transparently replaces the 32 bit interface.
>>> +@end deftypefun
>>> +
>>> +
>>> +@comment sys/uio.h
>>> +@comment GNU
>>> +@deftypefun ssize_t pwritev2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}, int @var{flags})
>>> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
>>> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
>>> +@c is also MT-Safe since it calls pwritev.
>>> +
>>> +This function is similar to the @code{pwritev} function, with the difference
>>> +it adds an extra @var{flags} parameter of type @code{int}. The supported
>>> +@var{flags} are dependent of the underlying system and for Linux it supports
>>> +the same ones as for @code{preadv2}.
>>> +
>>> +When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
>>> +@code{pwritev2} function is in fact @code{pwritev64v2} and the type
>>> +@code{off_t} has 64 bits, which makes it possible to handle files up to
>>> +@twoexp{63} bytes in length.
>>> +
>>> +The return value is a count of bytes (@emph{not} buffers) write, @math{0}
>>> +indicating end-of-file, or @math{-1} indicating an error. The possible
>>> +errors are the same as in @code{preadv2}.
>>> +@end deftypefun
>>> +
>>> +@comment unistd.h
>>> +@comment GNU
>>> +@deftypefun ssize_t pwritev64v2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}, int @var{flags})
>>> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
>>> +@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
>>> +@c is also MT-Safe since it calls pwritev.
>>> +
>>> +This function is similar to the @code{pwritev2} function with the difference
>>> +is that the @var{offset} parameter is of type @code{off64_t} instead of
>>> +@code{off_t}. It makes it possible on 32 bit machines to address
>>> +files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The
>>> +file descriptor @code{filedes} must be opened using @code{open64} since
>>> +otherwise the large offsets possible with @code{off64_t} will lead to
>>> +errors with a descriptor in small file mode.
>>> +
>>> +When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
>>> +32 bit machine this function is actually available under the name
>>> +@code{pwritev2} and so transparently replaces the 32 bit interface.
>>> +@end deftypefun
>>> +
>>>
>>> @node File Position Primitive
>>> @section Setting the File Position of a Descriptor
>>> diff --git a/misc/Makefile b/misc/Makefile
>>> index 622da67..bed46d7 100644
>>> --- a/misc/Makefile
>>> +++ b/misc/Makefile
>>> @@ -39,6 +39,7 @@ headers := sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
>>>
>>> routines := brk sbrk sstk ioctl \
>>> readv writev preadv preadv64 pwritev pwritev64 \
>>> + preadv2 preadv64v2 pwritev2 pwritev64v2 \
>>> setreuid setregid \
>>> seteuid setegid \
>>> getpagesize \
>>> @@ -79,7 +80,9 @@ gpl2lgpl := error.c error.h
>>> tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
>>> tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
>>> tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 \
>>> - tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \
>>> + tst-preadvwritev tst-preadvwritev64 tst-preadvwritev2 \
>>> + tst-preadvwritev64v2 \
>>> + tst-makedev tst-empty \
>>> tst-atomic tst-atomic-long
>>> tests-static := tst-empty
>>>
>>> diff --git a/misc/Versions b/misc/Versions
>>> index f2c90ff..bafda78 100644
>>> --- a/misc/Versions
>>> +++ b/misc/Versions
>>> @@ -155,6 +155,9 @@ libc {
>>> GLIBC_2.25 {
>>> gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;
>>> }
>>> + GLIBC_2.26 {
>>> + preadv2; preadv64v2; pwritev2; pwritev64v2;
>>> + }
>>> GLIBC_PRIVATE {
>>> __madvise;
>>> __mktemp;
>>> diff --git a/misc/preadv2.c b/misc/preadv2.c
>>> new file mode 100644
>>> index 0000000..a62dcaa
>>> --- /dev/null
>>> +++ b/misc/preadv2.c
>>> @@ -0,0 +1,30 @@
>>> +/* Default implementation of preadv2.
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <sys/uio.h>
>>> +
>>> +/* Same as preadv but with an additional flags argument. */
>>> +ssize_t
>>> +preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
>>> + int flags)
>>> +{
>>> + __set_errno (ENOSYS);
>>> + return -1;
>>> +}
>>> +
>>> +stub_warning (preadv2)
>>> diff --git a/misc/preadv64v2.c b/misc/preadv64v2.c
>>> new file mode 100644
>>> index 0000000..a802c2f
>>> --- /dev/null
>>> +++ b/misc/preadv64v2.c
>>> @@ -0,0 +1,30 @@
>>> +/* Default implementation of preadv2 (LFS version).
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <sys/uio.h>
>>> +
>>> +/* Same as preadv64 but with an addional flag argument. */
>>> +ssize_t
>>> +preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>>> + int flags)
>>> +{
>>> + __set_errno (ENOSYS);
>>> + return -1;
>>> +}
>>> +
>>> +stub_warning (preadv64v2)
>>> diff --git a/misc/pwritev2.c b/misc/pwritev2.c
>>> new file mode 100644
>>> index 0000000..b9e0727
>>> --- /dev/null
>>> +++ b/misc/pwritev2.c
>>> @@ -0,0 +1,30 @@
>>> +/* Default implementation of pwritev2.
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <sys/uio.h>
>>> +
>>> +/* Same as pwritev but with an additional flags argument. */
>>> +ssize_t
>>> +pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
>>> + int flags)
>>> +{
>>> + __set_errno (ENOSYS);
>>> + return -1;
>>> +}
>>> +
>>> +stub_warning (pwritev2)
>>> diff --git a/misc/pwritev64v2.c b/misc/pwritev64v2.c
>>> new file mode 100644
>>> index 0000000..1f874f0
>>> --- /dev/null
>>> +++ b/misc/pwritev64v2.c
>>> @@ -0,0 +1,30 @@
>>> +/* Default implementation of pwritev2 (LFS version).
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <sys/uio.h>
>>> +
>>> +/* Same as preadv64 but with an addional flag argument. */
>>> +ssize_t
>>> +pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>>> + int flags)
>>> +{
>>> + __set_errno (ENOSYS);
>>> + return -1;
>>> +}
>>> +
>>> +stub_warning (pwritev64v2)
>>> diff --git a/misc/sys/uio.h b/misc/sys/uio.h
>>> index e80f013..66c22f0 100644
>>> --- a/misc/sys/uio.h
>>> +++ b/misc/sys/uio.h
>>> @@ -76,6 +76,7 @@ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
>>> __THROW. */
>>> extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
>>> __off_t __offset) __wur;
>>> +
>>> # else
>>> # ifdef __REDIRECT
>>> extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec,
>>> @@ -117,6 +118,46 @@ extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count,
>>> # endif
>>> #endif /* Use misc. */
>>>
>>> +
>>> +#ifdef __USE_GNU
>>> +# ifndef __USE_FILE_OFFSET64
>>> +/* Same as preadv but with an additional flag argumenti defined at uio.h. */
>>> +extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count,
>>> + __off_t __offset, int ___flags) __wur;
>>> +
>>> +/* Same as preadv but with an additional flag argument defined at uio.h. */
>>> +extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count,
>>> + __off_t __offset, int __flags) __wur;
>>> +
>>> +# else
>>> +# ifdef __REDIRECT
>>> +extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec,
>>> + int __count, __off64_t __offset,
>>> + int __flags),
>>> + pwritev64v2) __wur;
>>> +extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec,
>>> + int __count, __off64_t __offset,
>>> + int __flags),
>>> + preadv64v2) __wur;
>>> +# else
>>> +# define preadv2 preadv64v2
>>> +# define pwritev2 pwritev64v2
>>> +# endif
>>> +# endif
>>> +
>>> +# ifdef __USE_LARGEFILE64
>>> +/* Same as preadv but with an additional flag argumenti defined at uio.h. */
>>> +extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec,
>>> + int __count, __off64_t __offset,
>>> + int ___flags) __wur;
>>> +
>>> +/* Same as preadv but with an additional flag argument defined at uio.h. */
>>> +extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev,
>>> + int __count, __off64_t __offset,
>>> + int __flags) __wur;
>>> +# endif
>>> +#endif /* Use GNU. */
>>> +
>>> __END_DECLS
>>>
>>> #endif /* sys/uio.h */
>>> diff --git a/misc/tst-preadvwritev-common.c b/misc/tst-preadvwritev-common.c
>>> index 5540dfb..676d495 100644
>>> --- a/misc/tst-preadvwritev-common.c
>>> +++ b/misc/tst-preadvwritev-common.c
>>> @@ -18,6 +18,7 @@
>>>
>>> #include <stdio.h>
>>> #include <stdint.h>
>>> +#include <errno.h>
>>> #include <string.h>
>>> #include <sys/uio.h>
>>> #include <sys/stat.h>
>>> @@ -39,6 +40,16 @@ do_prepare (int argc, char **argv)
>>> }
>>> #define PREPARE do_prepare
>>>
>>> +#ifndef PREADV
>>> +# define PREADV(__fd, __iov, __iovcnt, __offset) \
>>> + preadv (__fd, __iov, __iovcnt, __offset)
>>> +#endif
>>> +
>>> +#ifndef PWRITEV
>>> +# define PWRITEV(__fd, __iov, __iovcnt, __offset) \
>>> + pwritev (__fd, __iov, __iovcnt, __offset)
>>> +#endif
>>> +
>>> static int
>>> do_test_with_offset (off_t offset)
>>> {
>>> @@ -58,13 +69,13 @@ do_test_with_offset (off_t offset)
>>> iov[1].iov_base = buf2;
>>> iov[1].iov_len = sizeof buf2;
>>>
>>> - ret = pwritev (temp_fd, iov, 2, offset);
>>> + ret = PWRITEV (temp_fd, iov, 2, offset);
>>> if (ret == -1)
>>> FAIL_RET ("first pwritev returned -1");
>>> if (ret != (sizeof buf1 + sizeof buf2))
>>> FAIL_RET ("first pwritev returned an unexpected value");
>>>
>>> - ret = pwritev (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset);
>>> + ret = PWRITEV (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset);
>>> if (ret == -1)
>>> FAIL_RET ("second pwritev returned -1");
>>> if (ret != (sizeof buf1 + sizeof buf2))
>>> @@ -82,7 +93,7 @@ do_test_with_offset (off_t offset)
>>> iov[1].iov_len = sizeof buf4;
>>>
>>> /* Now read two buffer with 32 and 64 bytes respectively. */
>>> - ret = preadv (temp_fd, iov, 2, offset);
>>> + ret = PREADV (temp_fd, iov, 2, offset);
>>> if (ret == -1)
>>> FAIL_RET ("first preadv returned -1");
>>> if (ret != (sizeof buf3 + sizeof buf4))
>>> @@ -93,7 +104,7 @@ do_test_with_offset (off_t offset)
>>> if (memcmp (buf2, buf4, sizeof buf2) != 0)
>>> FAIL_RET ("second buffer from first preadv different than expected");
>>>
>>> - ret = preadv (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset);
>>> + ret = PREADV (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset);
>>> if (ret == -1)
>>> FAIL_RET ("second preadv returned -1");
>>> if (ret != (sizeof buf3 + sizeof buf4))
>>> diff --git a/misc/tst-preadvwritev2.c b/misc/tst-preadvwritev2.c
>>> new file mode 100644
>>> index 0000000..cf36272
>>> --- /dev/null
>>> +++ b/misc/tst-preadvwritev2.c
>>> @@ -0,0 +1,31 @@
>>> +/* Tests for preadv2 and pwritev2.
>>> + Copyright (C) 2016-2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#define PREADV(__fd, __iov, __iovcnt, __offset) \
>>> + preadv2 (__fd, __iov, __iovcnt, __offset, 0)
>>> +
>>> +#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
>>> + pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
>>> +
>>> +#include "tst-preadvwritev-common.c"
>>> +
>>> +static int
>>> +do_test (void)
>>> +{
>>> + return do_test_with_offset (0);
>>> +}
>>> diff --git a/misc/tst-preadvwritev64v2.c b/misc/tst-preadvwritev64v2.c
>>> new file mode 100644
>>> index 0000000..8d0c48e
>>> --- /dev/null
>>> +++ b/misc/tst-preadvwritev64v2.c
>>> @@ -0,0 +1,33 @@
>>> +/* Tests for preadv2 and pwritev2 (LFS version).
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#define _FILE_OFFSET_BITS 64
>>> +
>>> +#define PREADV(__fd, __iov, __iovcnt, __offset) \
>>> + preadv2 (__fd, __iov, __iovcnt, __offset, 0)
>>> +
>>> +#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
>>> + pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
>>> +
>>> +#include "tst-preadvwritev-common.c"
>>> +
>>> +static int
>>> +do_test (void)
>>> +{
>>> + return do_test_with_offset (0);
>>> +}
>>> diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c
>>> index e66961f..7a560a1 100644
>>> --- a/nptl/tst-cancel4.c
>>> +++ b/nptl/tst-cancel4.c
>>> @@ -1079,6 +1079,75 @@ tf_pwritev (void *arg)
>>> }
>>>
>>> static void *
>>> +tf_pwritev2 (void *arg)
>>> +{
>>> + int fd;
>>> +
>>> + if (arg == NULL)
>>> + /* XXX If somebody can provide a portable test case in which pwritev2
>>> + blocks we can enable this test to run in both rounds. */
>>> + abort ();
>>> +
>>> + errno = 0;
>>> +
>>> + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
>>> + tempfd = fd = mkstemp (fname);
>>> + if (fd == -1)
>>> + FAIL_EXIT1 ("mkstemp: %m");
>>> + unlink (fname);
>>> +
>>> + xpthread_barrier_wait (&b2);
>>> +
>>> + xpthread_barrier_wait (&b2);
>>> +
>>> + ssize_t s;
>>> + pthread_cleanup_push (cl, NULL);
>>> +
>>> + char buf[WRITE_BUFFER_SIZE];
>>> + memset (buf, '\0', sizeof (buf));
>>> + struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
>>> + s = pwritev2 (fd, iov, 1, 0, 0);
>>> +
>>> + pthread_cleanup_pop (0);
>>> +
>>> + FAIL_EXIT1 ("pwritev2 returns with %zd", s);
>>> +}
>>> +
>>> +static void *
>>> +tf_preadv2 (void *arg)
>>> +{
>>> + int fd;
>>> +
>>> + if (arg == NULL)
>>> + /* XXX If somebody can provide a portable test case in which preadv2
>>> + blocks we can enable this test to run in both rounds. */
>>> + abort ();
>>> +
>>> + errno = 0;
>>> +
>>> + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
>>> + tempfd = fd = mkstemp (fname);
>>> + if (fd == -1)
>>> + FAIL_EXIT1 ("mkstemp failed: %m");
>>> + unlink (fname);
>>> +
>>> + xpthread_barrier_wait (&b2);
>>> +
>>> + xpthread_barrier_wait (&b2);
>>> +
>>> + ssize_t s;
>>> + pthread_cleanup_push (cl, NULL);
>>> +
>>> + char buf[100];
>>> + struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
>>> + s = preadv2 (fd, iov, 1, 0, 0);
>>> +
>>> + pthread_cleanup_pop (0);
>>> +
>>> + FAIL_EXIT1 ("preadv2 returns with %zd", s);
>>> +}
>>> +
>>> +static void *
>>> tf_fsync (void *arg)
>>> {
>>> if (arg == NULL)
>>> @@ -1473,7 +1542,9 @@ struct cancel_tests tests[] =
>>> ADD_TEST (recvfrom, 2, 0),
>>> ADD_TEST (recvmsg, 2, 0),
>>> ADD_TEST (preadv, 2, 1),
>>> + ADD_TEST (preadv2, 2, 1),
>>> ADD_TEST (pwritev, 2, 1),
>>> + ADD_TEST (pwritev2, 2, 1),
>>> ADD_TEST (open, 2, 1),
>>> ADD_TEST (close, 2, 1),
>>> ADD_TEST (pread, 2, 1),
>>> diff --git a/sysdeps/posix/preadv2.c b/sysdeps/posix/preadv2.c
>>> new file mode 100644
>>> index 0000000..2a7cf11
>>> --- /dev/null
>>> +++ b/sysdeps/posix/preadv2.c
>>> @@ -0,0 +1,38 @@
>>> +/* Generic version of preadv2.
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <unistd.h>
>>> +#include <sys/uio.h>
>>> +
>>> +#ifndef __OFF_T_MATCHES_OFF64_T
>>> +
>>> +/* Since we define no flags for preadv2 just route to preadv. */
>>> +ssize_t
>>> +preadv2 (int fd, const struct iovec *vector, int count, OFF_T offset,
>>> + int flags)
>>> +{
>>> + if (flags != 0)
>>> + {
>>> + __set_errno (EOPNOTSUPP);
>>> + return -1;
>>> + }
>>> +
>>> + return preadv (fd, vector, count, offset);
>>> +}
>>> +
>>> +#endif
>>> diff --git a/sysdeps/posix/preadv64v2.c b/sysdeps/posix/preadv64v2.c
>>> new file mode 100644
>>> index 0000000..e084f3f
>>> --- /dev/null
>>> +++ b/sysdeps/posix/preadv64v2.c
>>> @@ -0,0 +1,37 @@
>>> +/* Generic version of preadv2.
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <unistd.>
>>> +#include <sys/uio.h>
>>> +
>>> +ssize_t
>>> +preadv64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
>>> + int flags)
>>> +{
>>> + if (flags != 0)
>>> + {
>>> + __set_errno (EOPNOTSUPP);
>>> + return -1;
>>> + }
>>> +
>>> + return preadv64 (fd, vector, count, offset);
>>> +}
>>> +
>>> +#ifdef __OFF_T_MATCHES_OFF64_T
>>> +strong_alias (preadv64v2, preadv2)
>>> +#endif
>>> diff --git a/sysdeps/posix/pwritev2.c b/sysdeps/posix/pwritev2.c
>>> new file mode 100644
>>> index 0000000..5b7650c
>>> --- /dev/null
>>> +++ b/sysdeps/posix/pwritev2.c
>>> @@ -0,0 +1,38 @@
>>> +/* Generic version of pwritev2.
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <unistd.h>
>>> +#include <sys/uio.h>
>>> +
>>> +#ifndef __OFF_T_MATCHES_OFF64_T
>>> +
>>> +/* Since we define no flags for pwritev2 just route to pwritev. */
>>> +ssize_t
>>> +pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset,
>>> + int flags)
>>> +{
>>> + if (flags != 0)
>>> + {
>>> + __set_errno (EOPNOTSUPP);
>>> + return -1;
>>> + }
>>> +
>>> + return pwritev (fd, vector, count, offset);
>>> +}
>>> +
>>> +#endif
>>> diff --git a/sysdeps/posix/pwritev64v2.c b/sysdeps/posix/pwritev64v2.c
>>> new file mode 100644
>>> index 0000000..d9727b9
>>> --- /dev/null
>>> +++ b/sysdeps/posix/pwritev64v2.c
>>> @@ -0,0 +1,38 @@
>>> +/* Generic version of pwritev2.
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <unistd.h>
>>> +#include <sys/uio.h>
>>> +
>>> +/* Since we define no flags for pwritev2 just route to pwritev. */
>>> +ssize_t
>>> +pwritev64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
>>> + int flags)
>>> +{
>>> + if (flags != 0)
>>> + {
>>> + __set_errno (EOPNOTSUPP);
>>> + return -1;
>>> + }
>>> +
>>> + return pwritev64 (fd, vector, count, offset);
>>> +}
>>> +
>>> +#ifdef __OFF_T_MATCHES_OFF64_T
>>> +strong_alias (pwritev64v2, pwritev2)
>>> +#endif
>>> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
>>> index 58d768c..296f2a5 100644
>>> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
>>> @@ -2097,3 +2097,8 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
>>> index 906050d..8006e72 100644
>>> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
>>> @@ -2008,6 +2008,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
>>> index 66112dd..29f9688 100644
>>> --- a/sysdeps/unix/sysv/linux/arm/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
>>> @@ -98,6 +98,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.4 GLIBC_2.4 A
>>> GLIBC_2.4 _Exit F
>>> GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>>> diff --git a/sysdeps/unix/sysv/linux/bits/uio.h b/sysdeps/unix/sysv/linux/bits/uio.h
>>> index 1583f04..d5701f8 100644
>>> --- a/sysdeps/unix/sysv/linux/bits/uio.h
>>> +++ b/sysdeps/unix/sysv/linux/bits/uio.h
>>> @@ -69,4 +69,10 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
>>> __END_DECLS
>>>
>>> # endif
>>> +
>>> +/* Flags for preadv2/pwritev2: */
>>> +#define RWF_HIPRI 0x00000001 /* High priority request. */
>>> +#define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC. */
>>> +#define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */
>>> +
>>> #endif
>>> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
>>> index 3ddadd2..e9cfbaf 100644
>>> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
>>> @@ -1862,6 +1862,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
>>> index 977ab90..c6ad3c3 100644
>>> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
>>> @@ -2020,6 +2020,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
>>> index c7edb9a..d0055a2 100644
>>> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
>>> @@ -1884,6 +1884,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
>>> index b981466..8ee1af7 100644
>>> --- a/sysdeps/unix/sysv/linux/kernel-features.h
>>> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
>>> @@ -137,3 +137,8 @@
>>> /* Support for SysV IPC through wired syscalls. All supported architectures
>>> either support ipc syscall and/or all the ipc correspondent syscalls. */
>>> #define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1
>>> +
>>> +/* Support for p{read,write}v2 was added in 4.6. However Linux default
>>> + implementation does not assume the __ASSUME_* and instead use a fallback
>>> + implementation based on p{read,write}v and returning an error for
>>> + non supported flags. */
>>> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
>>> index 450be4e..3777676 100644
>>> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
>>> @@ -99,6 +99,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.4 GLIBC_2.4 A
>>> GLIBC_2.4 _Exit F
>>> GLIBC_2.4 _IO_2_1_stderr_ D 0x98
>>> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
>>> index 9e016bd..8b1f80c 100644
>>> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
>>> @@ -1976,6 +1976,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
>>> index 1a455be..d4db9a8 100644
>>> --- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
>>> @@ -2097,3 +2097,8 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
>>> index 8eb5e66..f430bdb 100644
>>> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
>>> @@ -1951,6 +1951,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
>>> index 416d9ac..a4dca19 100644
>>> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
>>> @@ -1949,6 +1949,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
>>> index f4949e5..0814fa8 100644
>>> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
>>> @@ -1947,6 +1947,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
>>> index c7375ae..a0bdeff 100644
>>> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
>>> @@ -1942,6 +1942,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
>>> index 724a0e3..b201290 100644
>>> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
>>> @@ -2138,3 +2138,8 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>>> index 2dc32b6..6e7ff24 100644
>>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>>> @@ -1980,6 +1980,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>>> index 5658109..19c7c7d 100644
>>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>>> @@ -1985,6 +1985,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
>>> index c761221..e94ce38 100644
>>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
>>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
>>> @@ -2185,3 +2185,8 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
>>> index 265c769..f3daa33 100644
>>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
>>> @@ -99,6 +99,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 _Exit F
>>> GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
>>> diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c
>>> index 7d971cc..ecabc8c 100644
>>> --- a/sysdeps/unix/sysv/linux/preadv.c
>>> +++ b/sysdeps/unix/sysv/linux/preadv.c
>>> @@ -50,4 +50,6 @@ preadv (int fd, const struct iovec *vector, int count, off_t offset)
>>> # define OFF_T off_t
>>> # include <sysdeps/posix/preadv_common.c>
>>> # endif /* __ASSUME_PREADV */
>>> +
>>> +libc_hidden_def (preadv)
>>> #endif
>>> diff --git a/sysdeps/unix/sysv/linux/preadv2.c b/sysdeps/unix/sysv/linux/preadv2.c
>>> new file mode 100644
>>> index 0000000..11fe85e
>>> --- /dev/null
>>> +++ b/sysdeps/unix/sysv/linux/preadv2.c
>>> @@ -0,0 +1,55 @@
>>> +/* Linux implementation of preadv2.
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <sys/uio.h>
>>> +#include <sysdep-cancel.h>
>>> +
>>> +#ifndef __OFF_T_MATCHES_OFF64_T
>>> +
>>> +# if !defined (__NR_preadv2) && defined (__NR_pread64v2)
>>> +# define __NR_preadv2 __NR_pread64v2
>>> +# endif
>>> +
>>> +ssize_t
>>> +preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
>>> + int flags)
>>> +{
>>> +# ifdef __NR_preadv2
>>> + ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
>>> + LO_HI_LONG (offset), flags);
>>> + if (result >= 0 || errno != ENOSYS)
>>> + return result;
>>> +# endif
>>> + /* Trying to emulate the preadv2 syscall flags is troublesome:
>>> +
>>> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
>>> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
>>> + fcntl are silently ignored).
>>> +
>>> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>>> + semantic not provided by any other flag (O_NONBLOCK for instance). */
>>> +
>>> + if (flags != 0)
>>> + {
>>> + __set_errno (EOPNOTSUPP);
>>> + return -1;
>>> + }
>>> + return preadv (fd, vector, count, offset);
>>> +}
>>> +
>>> +#endif
>>> diff --git a/sysdeps/unix/sysv/linux/preadv64.c b/sysdeps/unix/sysv/linux/preadv64.c
>>> index 66daa74..c96b214 100644
>>> --- a/sysdeps/unix/sysv/linux/preadv64.c
>>> +++ b/sysdeps/unix/sysv/linux/preadv64.c
>>> @@ -48,7 +48,9 @@ preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
>>> # define OFF_T off64_t
>>> # include <sysdeps/posix/preadv_common.c>
>>> #endif
>>> +libc_hidden_def (preadv64)
>>>
>>> #ifdef __OFF_T_MATCHES_OFF64_T
>>> strong_alias (preadv64, preadv)
>>> +libc_hidden_def (preadv)
>>> #endif
>>> diff --git a/sysdeps/unix/sysv/linux/preadv64v2.c b/sysdeps/unix/sysv/linux/preadv64v2.c
>>> new file mode 100644
>>> index 0000000..9d7f8c9
>>> --- /dev/null
>>> +++ b/sysdeps/unix/sysv/linux/preadv64v2.c
>>> @@ -0,0 +1,55 @@
>>> +/* Linux implementation of preadv2 (LFS version).
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <sys/uio.h>
>>> +#include <sysdep-cancel.h>
>>> +
>>> +#if !defined(__NR_preadv64v2) && defined(__NR_preadv2)
>>> +# define __NR_preadv64v2 __NR_preadv2
>>> +#endif
>>> +
>>> +ssize_t
>>> +preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>>> + int flags)
>>> +{
>>> +#ifdef __NR_preadv64v2
>>> + ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
>>> + LO_HI_LONG (offset), flags);
>>> + if (result >= 0 || errno != ENOSYS)
>>> + return result;
>>> +#endif
>>> + /* Trying to emulate the preadv2 syscall flags is troublesome:
>>> +
>>> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
>>> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
>>> + fcntl are silently ignored).
>>> +
>>> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>>> + semantic not provided by any other flag (O_NONBLOCK for instance). */
>>> +
>>> + if (flags != 0)
>>> + {
>>> + __set_errno (EOPNOTSUPP);
>>> + return -1;
>>> + }
>>> + return preadv64 (fd, vector, count, offset);
>>> +}
>>> +
>>> +#ifdef __OFF_T_MATCHES_OFF64_T
>>> +strong_alias (preadv64v2, preadv2)
>>> +#endif
>>> diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
>>> index 57e5d20..71959c0 100644
>>> --- a/sysdeps/unix/sysv/linux/pwrite64.c
>>> +++ b/sysdeps/unix/sysv/linux/pwrite64.c
>>> @@ -28,6 +28,7 @@ __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
>>> {
>>> return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL64_PRW (offset));
>>> }
>>> +
>>> weak_alias (__libc_pwrite64, __pwrite64)
>>> libc_hidden_weak (__pwrite64)
>>> weak_alias (__libc_pwrite64, pwrite64)
>>> diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c
>>> index ce02996..7545cb3 100644
>>> --- a/sysdeps/unix/sysv/linux/pwritev.c
>>> +++ b/sysdeps/unix/sysv/linux/pwritev.c
>>> @@ -50,4 +50,6 @@ pwritev (int fd, const struct iovec *vector, int count, off_t offset)
>>> # define OFF_T off_t
>>> # include <sysdeps/posix/pwritev_common.c>
>>> # endif /* __ASSUME_PREADV */
>>> +
>>> +libc_hidden_def (pwritev)
>>> #endif
>>> diff --git a/sysdeps/unix/sysv/linux/pwritev2.c b/sysdeps/unix/sysv/linux/pwritev2.c
>>> new file mode 100644
>>> index 0000000..72f0471
>>> --- /dev/null
>>> +++ b/sysdeps/unix/sysv/linux/pwritev2.c
>>> @@ -0,0 +1,51 @@
>>> +/* Linux implementation of pwritev2.
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <sys/uio.h>
>>> +#include <sysdep-cancel.h>
>>> +
>>> +#ifndef __OFF_T_MATCHES_OFF64_T
>>> +
>>> +ssize_t
>>> +pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
>>> + int flags)
>>> +{
>>> +# ifdef __NR_pwritev2
>>> + ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
>>> + LO_HI_LONG (offset), flags);
>>> + if (result >= 0 || errno != ENOSYS)
>>> + return result;
>>> +# endif
>>> + /* Trying to emulate the pwritev2 syscall flags is troublesome:
>>> +
>>> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
>>> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
>>> + fcntl are silently ignored).
>>> +
>>> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>>> + semantic not provided by any other flag (O_NONBLOCK for instance). */
>>> +
>>> + if (flags != 0)
>>> + {
>>> + __set_errno (EOPNOTSUPP);
>>> + return -1;
>>> + }
>>> + return pwritev (fd, vector, count, offset);
>>> +}
>>> +
>>> +#endif
>>> diff --git a/sysdeps/unix/sysv/linux/pwritev64.c b/sysdeps/unix/sysv/linux/pwritev64.c
>>> index 45fb90b..9dc4e55 100644
>>> --- a/sysdeps/unix/sysv/linux/pwritev64.c
>>> +++ b/sysdeps/unix/sysv/linux/pwritev64.c
>>> @@ -48,7 +48,9 @@ pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
>>> # define OFF_T off64_t
>>> # include <sysdeps/posix/pwritev_common.c>
>>> #endif
>>> +libc_hidden_def (pwritev64)
>>>
>>> #ifdef __OFF_T_MATCHES_OFF64_T
>>> strong_alias (pwritev64, pwritev)
>>> +libc_hidden_def (pwritev)
>>> #endif
>>> diff --git a/sysdeps/unix/sysv/linux/pwritev64v2.c b/sysdeps/unix/sysv/linux/pwritev64v2.c
>>> new file mode 100644
>>> index 0000000..def9a0b
>>> --- /dev/null
>>> +++ b/sysdeps/unix/sysv/linux/pwritev64v2.c
>>> @@ -0,0 +1,55 @@
>>> +/* Linux implementation of pwritev2 (LFS version).
>>> + Copyright (C) 2017 Free Software Foundation, Inc.
>>> + This file is part of the GNU C Library.
>>> +
>>> + The GNU C Library is free software; you can redistribute it and/or
>>> + modify it under the terms of the GNU Lesser General Public
>>> + License as published by the Free Software Foundation; either
>>> + version 2.1 of the License, or (at your option) any later version.
>>> +
>>> + The GNU C Library is distributed in the hope that it will be useful,
>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> + Lesser General Public License for more details.
>>> +
>>> + You should have received a copy of the GNU Lesser General Public
>>> + License along with the GNU C Library; if not, see
>>> + <http://www.gnu.org/licenses/>. */
>>> +
>>> +#include <sys/uio.h>
>>> +#include <sysdep-cancel.h>
>>> +
>>> +#if !defined(__NR_pwritev64v2) && defined(__NR_pwritev2)
>>> +# define __NR_pwritev64v2 __NR_pwritev2
>>> +#endif
>>> +
>>> +ssize_t
>>> +pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>>> + int flags)
>>> +{
>>> +#ifdef __NR_pwritev64v2
>>> + ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
>>> + LO_HI_LONG (offset), flags);
>>> + if (result >= 0 || errno != ENOSYS)
>>> + return result;
>>> +#endif
>>> + /* Trying to emulate the pwritev2 syscall flags is troublesome:
>>> +
>>> + * We can not temporary change the file state of the O_DSYNC and O_SYNC
>>> + flags to emulate RWF_{D}SYNC (attempts to change the state of using
>>> + fcntl are silently ignored).
>>> +
>>> + * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
>>> + semantic not provided by any other flag (O_NONBLOCK for instance). */
>>> +
>>> + if (flags != 0)
>>> + {
>>> + __set_errno (EOPNOTSUPP);
>>> + return -1;
>>> + }
>>> + return pwritev64 (fd, vector, count, offset);
>>> +}
>>> +
>>> +#ifdef __OFF_T_MATCHES_OFF64_T
>>> +strong_alias (pwritev64v2, pwritev2)
>>> +#endif
>>> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
>>> index ed1b6bf..eb9e72f 100644
>>> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
>>> @@ -1980,6 +1980,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
>>> index 2e75d29..1402959 100644
>>> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
>>> @@ -1881,6 +1881,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
>>> index bd74c0c..e9eefcb 100644
>>> --- a/sysdeps/unix/sysv/linux/sh/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
>>> @@ -1866,6 +1866,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
>>> index 5584838..967699e 100644
>>> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
>>> @@ -1972,6 +1972,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
>>> index efedbe2..9dd938a 100644
>>> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
>>> @@ -1910,6 +1910,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
>>> index ffd988a..68c9887 100644
>>> --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
>>> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
>>> index f0c13ce..97aa0f7 100644
>>> --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
>>> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> diff --git a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
>>> index ffd988a..68c9887 100644
>>> --- a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
>>> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
>>> index f57004c..2032659 100644
>>> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
>>> @@ -1861,6 +1861,11 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>> GLIBC_2.3 GLIBC_2.3 A
>>> GLIBC_2.3 __ctype_b_loc F
>>> GLIBC_2.3 __ctype_tolower_loc F
>>> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
>>> index 05629e1..11a278c 100644
>>> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
>>> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
>>> @@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
>>> GLIBC_2.25 strfromd F
>>> GLIBC_2.25 strfromf F
>>> GLIBC_2.25 strfroml F
>>> +GLIBC_2.26 GLIBC_2.26 A
>>> +GLIBC_2.26 preadv2 F
>>> +GLIBC_2.26 preadv64v2 F
>>> +GLIBC_2.26 pwritev2 F
>>> +GLIBC_2.26 pwritev64v2 F
>>>
On Thursday 04 May 2017 06:13 PM, Adhemerval Zanella wrote:
> * nptl/tst-cancel4.c (tf_pwritev2): New test.
> (tf_preadv2): Likewise.
These tests are failing for tst-cancelx4 and tst-cancelx5 on the aarch64
buildbot:
tst-cancelx4.out:
cleanup handler not called for 'preadv2'
cleanup handler not called for 'pwritev2'
tst-cancelx5.out:
cleanup handler not called for 'preadv2'
cleanup handler not called for 'pwritev2'
Siddhesh
On 01/06/2017 13:40, Siddhesh Poyarekar wrote:
> On Thursday 04 May 2017 06:13 PM, Adhemerval Zanella wrote:
>> * nptl/tst-cancel4.c (tf_pwritev2): New test.
>> (tf_preadv2): Likewise.
>
> These tests are failing for tst-cancelx4 and tst-cancelx5 on the aarch64
> buildbot:
>
>
> tst-cancelx4.out:
>
> cleanup handler not called for 'preadv2'
> cleanup handler not called for 'pwritev2'
>
> tst-cancelx5.out:
>
> cleanup handler not called for 'preadv2'
> cleanup handler not called for 'pwritev2'
>
> Siddhesh
>
I am trying to figure out why this is failing on the bot, I can't reproduce
it on my aarch64 box (linux 3.19.0-33-generic, gcc 4.9.2). I also check on
x86_64 with and without p{read,write}v2 support (kernel 4.4.0 and
kernel 4.10). I will try check on a aarc64 with 4.6 kernel.
On Thu, Jun 1, 2017 at 11:14 AM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> On 01/06/2017 13:40, Siddhesh Poyarekar wrote:
>> On Thursday 04 May 2017 06:13 PM, Adhemerval Zanella wrote:
>>> * nptl/tst-cancel4.c (tf_pwritev2): New test.
>>> (tf_preadv2): Likewise.
>>
>> These tests are failing for tst-cancelx4 and tst-cancelx5 on the aarch64
>> buildbot:
>>
>>
>> tst-cancelx4.out:
>>
>> cleanup handler not called for 'preadv2'
>> cleanup handler not called for 'pwritev2'
>>
>> tst-cancelx5.out:
>>
>> cleanup handler not called for 'preadv2'
>> cleanup handler not called for 'pwritev2'
>>
>> Siddhesh
>>
>
> I am trying to figure out why this is failing on the bot, I can't reproduce
> it on my aarch64 box (linux 3.19.0-33-generic, gcc 4.9.2). I also check on
> x86_64 with and without p{read,write}v2 support (kernel 4.4.0 and
> kernel 4.10). I will try check on a aarc64 with 4.6 kernel.
I got
[hjl@gnu-tools-1 build-x86_64-linux]$ ./misc/tst-preadvwritev2
error: tst-preadvwritev-common.c:74: first pwritev returned -1
error: 1 test failures
[hjl@gnu-tools-1 build-x86_64-linux]$
on one of my x86-64 machines. But when I ran it under gdb, it passed.
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> On 01/06/2017 13:40, Siddhesh Poyarekar wrote:
>> On Thursday 04 May 2017 06:13 PM, Adhemerval Zanella wrote:
>>> * nptl/tst-cancel4.c (tf_pwritev2): New test.
>>> (tf_preadv2): Likewise.
>>
>> These tests are failing for tst-cancelx4 and tst-cancelx5 on the aarch64
>> buildbot:
>>
>>
>> tst-cancelx4.out:
>>
>> cleanup handler not called for 'preadv2'
>> cleanup handler not called for 'pwritev2'
>>
>> tst-cancelx5.out:
>>
>> cleanup handler not called for 'preadv2'
>> cleanup handler not called for 'pwritev2'
>>
>> Siddhesh
>>
>
> I am trying to figure out why this is failing on the bot, I can't reproduce
> it on my aarch64 box (linux 3.19.0-33-generic, gcc 4.9.2). I also check on
> x86_64 with and without p{read,write}v2 support (kernel 4.4.0 and
> kernel 4.10). I will try check on a aarc64 with 4.6 kernel.
I can reproduce the same error on ppc64 and ppc64le with Linux 4.4 and 4.10.
On Fri, Jun 2, 2017 at 9:00 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>
> I got
>
> [hjl@gnu-tools-1 build-x86_64-linux]$ ./misc/tst-preadvwritev2
> error: tst-preadvwritev-common.c:74: first pwritev returned -1
> error: 1 test failures
> [hjl@gnu-tools-1 build-x86_64-linux]$
>
> on one of my x86-64 machines. But when I ran it under gdb, it passed.
I see this as well, for both tst-preadvwritev2 and
tst-preadvwritev64v2 on my x86-64 machine (kernel 4.9). Like HJ, if I
run the test manually, it succeeds.
(And apart for everything else, that error message needs to be fixed
to print strerror(errno).)
zw
On 06/02/2017 03:04 PM, Zack Weinberg wrote:
> I see this as well, for both tst-preadvwritev2 and
> tst-preadvwritev64v2 on my x86-64 machine (kernel 4.9). Like HJ, if I
> run the test manually, it succeeds.
I see this on x86-64.
pwritev2(3,
[{iov_base="\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360",
iov_len=32},
{iov_base="\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"...,
iov_len=64}], 2, 0, 0x30 /* RWF_??? */) = -1 EOPNOTSUPP (Operation not
supported)
On a kernel which supports pwritev2 in general. I do not know yet where
the 0x30 comes from.
Florian
On 02/06/2017 10:02, Tulio Magno Quites Machado Filho wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>
>> On 01/06/2017 13:40, Siddhesh Poyarekar wrote:
>>> On Thursday 04 May 2017 06:13 PM, Adhemerval Zanella wrote:
>>>> * nptl/tst-cancel4.c (tf_pwritev2): New test.
>>>> (tf_preadv2): Likewise.
>>>
>>> These tests are failing for tst-cancelx4 and tst-cancelx5 on the aarch64
>>> buildbot:
>>>
>>>
>>> tst-cancelx4.out:
>>>
>>> cleanup handler not called for 'preadv2'
>>> cleanup handler not called for 'pwritev2'
>>>
>>> tst-cancelx5.out:
>>>
>>> cleanup handler not called for 'preadv2'
>>> cleanup handler not called for 'pwritev2'
>>>
>>> Siddhesh
>>>
>>
>> I am trying to figure out why this is failing on the bot, I can't reproduce
>> it on my aarch64 box (linux 3.19.0-33-generic, gcc 4.9.2). I also check on
>> x86_64 with and without p{read,write}v2 support (kernel 4.4.0 and
>> kernel 4.10). I will try check on a aarc64 with 4.6 kernel.
>
> I can reproduce the same error on ppc64 and ppc64le with Linux 4.4 and 4.10.
>
The cancellation issue is the missing build flags to make cancellation
work correctly on some architectures (-fexceptions -fasynchronous-unwind-tables).
It fixed the issue in ppc64le environment I have access. I will push this
upstream.
On 02/06/2017 10:34, Florian Weimer wrote:
> On 06/02/2017 03:04 PM, Zack Weinberg wrote:
>> I see this as well, for both tst-preadvwritev2 and
>> tst-preadvwritev64v2 on my x86-64 machine (kernel 4.9). Like HJ, if I
>> run the test manually, it succeeds.
>
> I see this on x86-64.
>
> pwritev2(3,
> [{iov_base="\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360",
> iov_len=32},
> {iov_base="\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"...,
> iov_len=64}], 2, 0, 0x30 /* RWF_??? */) = -1 EOPNOTSUPP (Operation not
> supported)
>
> On a kernel which supports pwritev2 in general. I do not know yet where
> the 0x30 comes from.
>
> Florian
>
This one still puzzles me, on 4.10.0 with gcc 6.3.0 I am seeing:
[...]
[pid 28447] setpgid(0, 0) = 0
[pid 28447] pwritev2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 0, 0) = 96
[pid 28447] pwritev2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 96, 0) = 96
[pid 28447] preadv2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 0, 0) = 96
[pid 28447] preadv2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 96, 0) = 96
[pid 28447] getpid() = 28447
[...]
This only issue I can think of is something very fuzzy in test build or a miscompilation.
On Fri, Jun 2, 2017 at 10:07 AM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
> On 02/06/2017 10:34, Florian Weimer wrote:
>> On 06/02/2017 03:04 PM, Zack Weinberg wrote:
>>> I see this as well, for both tst-preadvwritev2 and
>>> tst-preadvwritev64v2 on my x86-64 machine (kernel 4.9). Like HJ, if I
>>> run the test manually, it succeeds.
>>
>> I see this on x86-64.
>>
>> pwritev2(3,
>> [{iov_base="\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360",
>> iov_len=32},
>> {iov_base="\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"...,
>> iov_len=64}], 2, 0, 0x30 /* RWF_??? */) = -1 EOPNOTSUPP (Operation not
>> supported)
>>
>> On a kernel which supports pwritev2 in general. I do not know yet where
>> the 0x30 comes from.
>>
>> Florian
>>
>
> This one still puzzles me, on 4.10.0 with gcc 6.3.0 I am seeing:
>
> [...]
> [pid 28447] setpgid(0, 0) = 0
> [pid 28447] pwritev2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 0, 0) = 96
> [pid 28447] pwritev2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 96, 0) = 96
> [pid 28447] preadv2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 0, 0) = 96
> [pid 28447] preadv2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 96, 0) = 96
> [pid 28447] getpid() = 28447
> [...]
>
> This only issue I can think of is something very fuzzy in test build or a miscompilation.
There's gotta be something wonky with the argument passing. Maybe try
running the test case under valgrind? Also this trick often helps
when a failure goes away when you run it manually:
export CHANGE_SIZE_OF_ENV=""
while
the-command-that-should-fail
do
CHANGE_SIZE_OF_ENV="${CHANGE_SIZE_OF_ENV}x"
echo -n .
done; echo
zw
On 02/06/2017 11:22, Zack Weinberg wrote:
> On Fri, Jun 2, 2017 at 10:07 AM, Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>> On 02/06/2017 10:34, Florian Weimer wrote:
>>> On 06/02/2017 03:04 PM, Zack Weinberg wrote:
>>>> I see this as well, for both tst-preadvwritev2 and
>>>> tst-preadvwritev64v2 on my x86-64 machine (kernel 4.9). Like HJ, if I
>>>> run the test manually, it succeeds.
>>>
>>> I see this on x86-64.
>>>
>>> pwritev2(3,
>>> [{iov_base="\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360",
>>> iov_len=32},
>>> {iov_base="\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"...,
>>> iov_len=64}], 2, 0, 0x30 /* RWF_??? */) = -1 EOPNOTSUPP (Operation not
>>> supported)
>>>
>>> On a kernel which supports pwritev2 in general. I do not know yet where
>>> the 0x30 comes from.
>>>
>>> Florian
>>>
>>
>> This one still puzzles me, on 4.10.0 with gcc 6.3.0 I am seeing:
>>
>> [...]
>> [pid 28447] setpgid(0, 0) = 0
>> [pid 28447] pwritev2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 0, 0) = 96
>> [pid 28447] pwritev2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 96, 0) = 96
>> [pid 28447] preadv2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 0, 0) = 96
>> [pid 28447] preadv2(3, [{"\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360\360", 32}, {"\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17\17"..., 64}], 2, 96, 0) = 96
>> [pid 28447] getpid() = 28447
>> [...]
>>
>> This only issue I can think of is something very fuzzy in test build or a miscompilation.
>
> There's gotta be something wonky with the argument passing. Maybe try
> running the test case under valgrind? Also this trick often helps
> when a failure goes away when you run it manually:
>
> export CHANGE_SIZE_OF_ENV=""
> while
> the-command-that-should-fail
> do
> CHANGE_SIZE_OF_ENV="${CHANGE_SIZE_OF_ENV}x"
> echo -n .
> done; echo
>
> zw
>
I am even more confident this is indeed a miscompilation from GCC7 branch.
Using a previous built x86_64-linux-gnu with GCC6 branch I saw no issue, however
using GCC7 there is indeed the test failure. And it seems to show only for kernels
with support for p{read,write}v2 syscall, which means it stress the default
SYSCALL_CANCEL path.
However, running a GCC6 built testcase with a GCC7 build glibc (with testrun.sh)
I saw no issue. The GCC7 built test also fails with a GCC6 built glibc. I will
check with GCC master to see if this is something only on GCC7 branch or if it
is still on master.
Also, I seems that for GCC7 only x86_64-linux-gnu is affect on x86.
On 06/02/2017 08:19 PM, Adhemerval Zanella wrote:
> I am even more confident this is indeed a miscompilation from GCC7 branch.
> Using a previous built x86_64-linux-gnu with GCC6 branch I saw no issue, however
> using GCC7 there is indeed the test failure. And it seems to show only for kernels
> with support for p{read,write}v2 syscall, which means it stress the default
> SYSCALL_CANCEL path.
>
> However, running a GCC6 built testcase with a GCC7 build glibc (with testrun.sh)
> I saw no issue. The GCC7 built test also fails with a GCC6 built glibc. I will
> check with GCC master to see if this is something only on GCC7 branch or if it
> is still on master.
>
> Also, I seems that for GCC7 only x86_64-linux-gnu is affect on x86.
I see it with GCC 6.3 on Fedora 24, x86-64 as well. It could be a
broken GCC 7 patch that was backported, or perhaps our constraints for
the syscall instruction are off.
Florian
On 02/06/2017 16:02, Florian Weimer wrote:
> On 06/02/2017 08:19 PM, Adhemerval Zanella wrote:
>> I am even more confident this is indeed a miscompilation from GCC7 branch.
>> Using a previous built x86_64-linux-gnu with GCC6 branch I saw no issue, however
>> using GCC7 there is indeed the test failure. And it seems to show only for kernels
>> with support for p{read,write}v2 syscall, which means it stress the default
>> SYSCALL_CANCEL path.
>>
>> However, running a GCC6 built testcase with a GCC7 build glibc (with testrun.sh)
>> I saw no issue. The GCC7 built test also fails with a GCC6 built glibc. I will
>> check with GCC master to see if this is something only on GCC7 branch or if it
>> is still on master.
>>
>> Also, I seems that for GCC7 only x86_64-linux-gnu is affect on x86.
>
> I see it with GCC 6.3 on Fedora 24, x86-64 as well. It could be a
> broken GCC 7 patch that was backported, or perhaps our constraints for
> the syscall instruction are off.
My GCC 6.3 was built with build-many-glibcs.py, so I assume it contains
no backports. I just checked with GCC trunk (gcc version 8.0.0 20170602)
built also with build-many-glibcs.py and it does not trigger the issue.
@@ -57,6 +57,13 @@ Version 2.26
be added on next major revision of POSIX, so current support is enabled
with _GNU_SOURCE.
+* New preadv2 and pwritev2 are added to libc. They are Linux extensions to
+ preadv and pwritev with an additional flag argument where it is possible
+ to set high priority or use O_DSYNC or O_SYNC for an specific IO operation.
+ For complete support it requires Linux kernel version 4.6, otherwise a
+ compat implementation will be used (which refuses all flags and routes it
+ to preadv or pwritev).
+
Security related changes:
* The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes,
@@ -7,5 +7,11 @@ extern ssize_t __readv (int __fd, const struct iovec *__iovec,
int __count);
extern ssize_t __writev (int __fd, const struct iovec *__iovec,
int __count);
+
+/* Used for p{read,write}{v64}v2 implementation. */
+libc_hidden_proto (preadv)
+libc_hidden_proto (preadv64)
+libc_hidden_proto (pwritev)
+libc_hidden_proto (pwritev64)
#endif
#endif
@@ -756,6 +756,115 @@ When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
@code{pwritev} and so transparently replaces the 32 bit interface.
@end deftypefun
+@comment sys/uio.h
+@comment GNU
+@deftypefun ssize_t preadv2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}, int @var{flags})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
+@c is also MT-Safe since it calls preadv.
+
+This function is similar to the @code{preadv} function, with the difference
+it adds an extra @var{flags} parameter of type @code{int}. The supported
+@var{flags} are dependent of the underlying system. For Linux it supports:
+
+@vtable @code
+@item RWF_HIPRI
+High priority request. This adds a flag that tells the file system that
+this is a high priority request for which it is worth to poll the hardware.
+The flag is purely advisory and can be ignored if not supported. The
+@var{fd} must be opened using @code{O_DIRECT}.
+
+@item RWF_DSYNC
+Per-IO synchronization as if the file was opened with @code{O_DSYNC} flag.
+
+@item RWF_SYNC
+Per-IO synchronization as if the file was opened with @code{O_SYNC} flag.
+@end vtable
+
+When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
+@code{preadv2} function is in fact @code{preadv64v2} and the type
+@code{off_t} has 64 bits, which makes it possible to handle files up to
+@twoexp{63} bytes in length.
+
+The return value is a count of bytes (@emph{not} buffers) read, @math{0}
+indicating end-of-file, or @math{-1} indicating an error. The possible
+errors are the same as in @code{preadv} with the addition of:
+
+@table @code
+
+@item EOPNOTSUPP
+
+@c The default sysdeps/posix code will return it for any flags value
+@c different than 0.
+An unsupported @var{flags} was used.
+
+@end table
+
+@end deftypefun
+
+@comment unistd.h
+@comment GNU
+@deftypefun ssize_t preadv64v2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}, int @var{flags})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
+@c is also MT-Safe since it calls preadv.
+
+This function is similar to the @code{preadv2} function with the difference
+is that the @var{offset} parameter is of type @code{off64_t} instead of
+@code{off_t}. It makes it possible on 32 bit machines to address
+files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The
+file descriptor @code{filedes} must be opened using @code{open64} since
+otherwise the large offsets possible with @code{off64_t} will lead to
+errors with a descriptor in small file mode.
+
+When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
+32 bit machine this function is actually available under the name
+@code{preadv2} and so transparently replaces the 32 bit interface.
+@end deftypefun
+
+
+@comment sys/uio.h
+@comment GNU
+@deftypefun ssize_t pwritev2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}, int @var{flags})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
+@c is also MT-Safe since it calls pwritev.
+
+This function is similar to the @code{pwritev} function, with the difference
+it adds an extra @var{flags} parameter of type @code{int}. The supported
+@var{flags} are dependent of the underlying system and for Linux it supports
+the same ones as for @code{preadv2}.
+
+When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
+@code{pwritev2} function is in fact @code{pwritev64v2} and the type
+@code{off_t} has 64 bits, which makes it possible to handle files up to
+@twoexp{63} bytes in length.
+
+The return value is a count of bytes (@emph{not} buffers) write, @math{0}
+indicating end-of-file, or @math{-1} indicating an error. The possible
+errors are the same as in @code{preadv2}.
+@end deftypefun
+
+@comment unistd.h
+@comment GNU
+@deftypefun ssize_t pwritev64v2 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}, int @var{flags})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+@c This is a syscall for Linux v4.6. The sysdeps/posix fallback emulation
+@c is also MT-Safe since it calls pwritev.
+
+This function is similar to the @code{pwritev2} function with the difference
+is that the @var{offset} parameter is of type @code{off64_t} instead of
+@code{off_t}. It makes it possible on 32 bit machines to address
+files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The
+file descriptor @code{filedes} must be opened using @code{open64} since
+otherwise the large offsets possible with @code{off64_t} will lead to
+errors with a descriptor in small file mode.
+
+When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a
+32 bit machine this function is actually available under the name
+@code{pwritev2} and so transparently replaces the 32 bit interface.
+@end deftypefun
+
@node File Position Primitive
@section Setting the File Position of a Descriptor
@@ -39,6 +39,7 @@ headers := sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
routines := brk sbrk sstk ioctl \
readv writev preadv preadv64 pwritev pwritev64 \
+ preadv2 preadv64v2 pwritev2 pwritev64v2 \
setreuid setregid \
seteuid setegid \
getpagesize \
@@ -79,7 +80,9 @@ gpl2lgpl := error.c error.h
tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 \
- tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \
+ tst-preadvwritev tst-preadvwritev64 tst-preadvwritev2 \
+ tst-preadvwritev64v2 \
+ tst-makedev tst-empty \
tst-atomic tst-atomic-long
tests-static := tst-empty
@@ -155,6 +155,9 @@ libc {
GLIBC_2.25 {
gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;
}
+ GLIBC_2.26 {
+ preadv2; preadv64v2; pwritev2; pwritev64v2;
+ }
GLIBC_PRIVATE {
__madvise;
__mktemp;
new file mode 100644
@@ -0,0 +1,30 @@
+/* Default implementation of preadv2.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+
+/* Same as preadv but with an additional flags argument. */
+ssize_t
+preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (preadv2)
new file mode 100644
@@ -0,0 +1,30 @@
+/* Default implementation of preadv2 (LFS version).
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+
+/* Same as preadv64 but with an addional flag argument. */
+ssize_t
+preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (preadv64v2)
new file mode 100644
@@ -0,0 +1,30 @@
+/* Default implementation of pwritev2.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+
+/* Same as pwritev but with an additional flags argument. */
+ssize_t
+pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (pwritev2)
new file mode 100644
@@ -0,0 +1,30 @@
+/* Default implementation of pwritev2 (LFS version).
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+
+/* Same as preadv64 but with an addional flag argument. */
+ssize_t
+pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (pwritev64v2)
@@ -76,6 +76,7 @@ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
__THROW. */
extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
__off_t __offset) __wur;
+
# else
# ifdef __REDIRECT
extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec,
@@ -117,6 +118,46 @@ extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count,
# endif
#endif /* Use misc. */
+
+#ifdef __USE_GNU
+# ifndef __USE_FILE_OFFSET64
+/* Same as preadv but with an additional flag argumenti defined at uio.h. */
+extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count,
+ __off_t __offset, int ___flags) __wur;
+
+/* Same as preadv but with an additional flag argument defined at uio.h. */
+extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count,
+ __off_t __offset, int __flags) __wur;
+
+# else
+# ifdef __REDIRECT
+extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec,
+ int __count, __off64_t __offset,
+ int __flags),
+ pwritev64v2) __wur;
+extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec,
+ int __count, __off64_t __offset,
+ int __flags),
+ preadv64v2) __wur;
+# else
+# define preadv2 preadv64v2
+# define pwritev2 pwritev64v2
+# endif
+# endif
+
+# ifdef __USE_LARGEFILE64
+/* Same as preadv but with an additional flag argumenti defined at uio.h. */
+extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec,
+ int __count, __off64_t __offset,
+ int ___flags) __wur;
+
+/* Same as preadv but with an additional flag argument defined at uio.h. */
+extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev,
+ int __count, __off64_t __offset,
+ int __flags) __wur;
+# endif
+#endif /* Use GNU. */
+
__END_DECLS
#endif /* sys/uio.h */
@@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdint.h>
+#include <errno.h>
#include <string.h>
#include <sys/uio.h>
#include <sys/stat.h>
@@ -39,6 +40,16 @@ do_prepare (int argc, char **argv)
}
#define PREPARE do_prepare
+#ifndef PREADV
+# define PREADV(__fd, __iov, __iovcnt, __offset) \
+ preadv (__fd, __iov, __iovcnt, __offset)
+#endif
+
+#ifndef PWRITEV
+# define PWRITEV(__fd, __iov, __iovcnt, __offset) \
+ pwritev (__fd, __iov, __iovcnt, __offset)
+#endif
+
static int
do_test_with_offset (off_t offset)
{
@@ -58,13 +69,13 @@ do_test_with_offset (off_t offset)
iov[1].iov_base = buf2;
iov[1].iov_len = sizeof buf2;
- ret = pwritev (temp_fd, iov, 2, offset);
+ ret = PWRITEV (temp_fd, iov, 2, offset);
if (ret == -1)
FAIL_RET ("first pwritev returned -1");
if (ret != (sizeof buf1 + sizeof buf2))
FAIL_RET ("first pwritev returned an unexpected value");
- ret = pwritev (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset);
+ ret = PWRITEV (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset);
if (ret == -1)
FAIL_RET ("second pwritev returned -1");
if (ret != (sizeof buf1 + sizeof buf2))
@@ -82,7 +93,7 @@ do_test_with_offset (off_t offset)
iov[1].iov_len = sizeof buf4;
/* Now read two buffer with 32 and 64 bytes respectively. */
- ret = preadv (temp_fd, iov, 2, offset);
+ ret = PREADV (temp_fd, iov, 2, offset);
if (ret == -1)
FAIL_RET ("first preadv returned -1");
if (ret != (sizeof buf3 + sizeof buf4))
@@ -93,7 +104,7 @@ do_test_with_offset (off_t offset)
if (memcmp (buf2, buf4, sizeof buf2) != 0)
FAIL_RET ("second buffer from first preadv different than expected");
- ret = preadv (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset);
+ ret = PREADV (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset);
if (ret == -1)
FAIL_RET ("second preadv returned -1");
if (ret != (sizeof buf3 + sizeof buf4))
new file mode 100644
@@ -0,0 +1,31 @@
+/* Tests for preadv2 and pwritev2.
+ Copyright (C) 2016-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#define PREADV(__fd, __iov, __iovcnt, __offset) \
+ preadv2 (__fd, __iov, __iovcnt, __offset, 0)
+
+#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
+ pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
+
+#include "tst-preadvwritev-common.c"
+
+static int
+do_test (void)
+{
+ return do_test_with_offset (0);
+}
new file mode 100644
@@ -0,0 +1,33 @@
+/* Tests for preadv2 and pwritev2 (LFS version).
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#define _FILE_OFFSET_BITS 64
+
+#define PREADV(__fd, __iov, __iovcnt, __offset) \
+ preadv2 (__fd, __iov, __iovcnt, __offset, 0)
+
+#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
+ pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
+
+#include "tst-preadvwritev-common.c"
+
+static int
+do_test (void)
+{
+ return do_test_with_offset (0);
+}
@@ -1079,6 +1079,75 @@ tf_pwritev (void *arg)
}
static void *
+tf_pwritev2 (void *arg)
+{
+ int fd;
+
+ if (arg == NULL)
+ /* XXX If somebody can provide a portable test case in which pwritev2
+ blocks we can enable this test to run in both rounds. */
+ abort ();
+
+ errno = 0;
+
+ char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+ tempfd = fd = mkstemp (fname);
+ if (fd == -1)
+ FAIL_EXIT1 ("mkstemp: %m");
+ unlink (fname);
+
+ xpthread_barrier_wait (&b2);
+
+ xpthread_barrier_wait (&b2);
+
+ ssize_t s;
+ pthread_cleanup_push (cl, NULL);
+
+ char buf[WRITE_BUFFER_SIZE];
+ memset (buf, '\0', sizeof (buf));
+ struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
+ s = pwritev2 (fd, iov, 1, 0, 0);
+
+ pthread_cleanup_pop (0);
+
+ FAIL_EXIT1 ("pwritev2 returns with %zd", s);
+}
+
+static void *
+tf_preadv2 (void *arg)
+{
+ int fd;
+
+ if (arg == NULL)
+ /* XXX If somebody can provide a portable test case in which preadv2
+ blocks we can enable this test to run in both rounds. */
+ abort ();
+
+ errno = 0;
+
+ char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+ tempfd = fd = mkstemp (fname);
+ if (fd == -1)
+ FAIL_EXIT1 ("mkstemp failed: %m");
+ unlink (fname);
+
+ xpthread_barrier_wait (&b2);
+
+ xpthread_barrier_wait (&b2);
+
+ ssize_t s;
+ pthread_cleanup_push (cl, NULL);
+
+ char buf[100];
+ struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
+ s = preadv2 (fd, iov, 1, 0, 0);
+
+ pthread_cleanup_pop (0);
+
+ FAIL_EXIT1 ("preadv2 returns with %zd", s);
+}
+
+static void *
tf_fsync (void *arg)
{
if (arg == NULL)
@@ -1473,7 +1542,9 @@ struct cancel_tests tests[] =
ADD_TEST (recvfrom, 2, 0),
ADD_TEST (recvmsg, 2, 0),
ADD_TEST (preadv, 2, 1),
+ ADD_TEST (preadv2, 2, 1),
ADD_TEST (pwritev, 2, 1),
+ ADD_TEST (pwritev2, 2, 1),
ADD_TEST (open, 2, 1),
ADD_TEST (close, 2, 1),
ADD_TEST (pread, 2, 1),
new file mode 100644
@@ -0,0 +1,38 @@
+/* Generic version of preadv2.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+#include <sys/uio.h>
+
+#ifndef __OFF_T_MATCHES_OFF64_T
+
+/* Since we define no flags for preadv2 just route to preadv. */
+ssize_t
+preadv2 (int fd, const struct iovec *vector, int count, OFF_T offset,
+ int flags)
+{
+ if (flags != 0)
+ {
+ __set_errno (EOPNOTSUPP);
+ return -1;
+ }
+
+ return preadv (fd, vector, count, offset);
+}
+
+#endif
new file mode 100644
@@ -0,0 +1,37 @@
+/* Generic version of preadv2.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.>
+#include <sys/uio.h>
+
+ssize_t
+preadv64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
+ int flags)
+{
+ if (flags != 0)
+ {
+ __set_errno (EOPNOTSUPP);
+ return -1;
+ }
+
+ return preadv64 (fd, vector, count, offset);
+}
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+strong_alias (preadv64v2, preadv2)
+#endif
new file mode 100644
@@ -0,0 +1,38 @@
+/* Generic version of pwritev2.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+#include <sys/uio.h>
+
+#ifndef __OFF_T_MATCHES_OFF64_T
+
+/* Since we define no flags for pwritev2 just route to pwritev. */
+ssize_t
+pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset,
+ int flags)
+{
+ if (flags != 0)
+ {
+ __set_errno (EOPNOTSUPP);
+ return -1;
+ }
+
+ return pwritev (fd, vector, count, offset);
+}
+
+#endif
new file mode 100644
@@ -0,0 +1,38 @@
+/* Generic version of pwritev2.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Since we define no flags for pwritev2 just route to pwritev. */
+ssize_t
+pwritev64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
+ int flags)
+{
+ if (flags != 0)
+ {
+ __set_errno (EOPNOTSUPP);
+ return -1;
+ }
+
+ return pwritev64 (fd, vector, count, offset);
+}
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+strong_alias (pwritev64v2, pwritev2)
+#endif
@@ -2097,3 +2097,8 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
@@ -2008,6 +2008,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -98,6 +98,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.4 GLIBC_2.4 A
GLIBC_2.4 _Exit F
GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
@@ -69,4 +69,10 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
__END_DECLS
# endif
+
+/* Flags for preadv2/pwritev2: */
+#define RWF_HIPRI 0x00000001 /* High priority request. */
+#define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC. */
+#define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */
+
#endif
@@ -1862,6 +1862,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -2020,6 +2020,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -1884,6 +1884,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -137,3 +137,8 @@
/* Support for SysV IPC through wired syscalls. All supported architectures
either support ipc syscall and/or all the ipc correspondent syscalls. */
#define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1
+
+/* Support for p{read,write}v2 was added in 4.6. However Linux default
+ implementation does not assume the __ASSUME_* and instead use a fallback
+ implementation based on p{read,write}v and returning an error for
+ non supported flags. */
@@ -99,6 +99,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.4 GLIBC_2.4 A
GLIBC_2.4 _Exit F
GLIBC_2.4 _IO_2_1_stderr_ D 0x98
@@ -1976,6 +1976,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -2097,3 +2097,8 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
@@ -1951,6 +1951,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -1949,6 +1949,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -1947,6 +1947,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -1942,6 +1942,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -2138,3 +2138,8 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
@@ -1980,6 +1980,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -1985,6 +1985,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -2185,3 +2185,8 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
@@ -99,6 +99,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 _Exit F
GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
@@ -50,4 +50,6 @@ preadv (int fd, const struct iovec *vector, int count, off_t offset)
# define OFF_T off_t
# include <sysdeps/posix/preadv_common.c>
# endif /* __ASSUME_PREADV */
+
+libc_hidden_def (preadv)
#endif
new file mode 100644
@@ -0,0 +1,55 @@
+/* Linux implementation of preadv2.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+#include <sysdep-cancel.h>
+
+#ifndef __OFF_T_MATCHES_OFF64_T
+
+# if !defined (__NR_preadv2) && defined (__NR_pread64v2)
+# define __NR_preadv2 __NR_pread64v2
+# endif
+
+ssize_t
+preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
+ int flags)
+{
+# ifdef __NR_preadv2
+ ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
+ LO_HI_LONG (offset), flags);
+ if (result >= 0 || errno != ENOSYS)
+ return result;
+# endif
+ /* Trying to emulate the preadv2 syscall flags is troublesome:
+
+ * We can not temporary change the file state of the O_DSYNC and O_SYNC
+ flags to emulate RWF_{D}SYNC (attempts to change the state of using
+ fcntl are silently ignored).
+
+ * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
+ semantic not provided by any other flag (O_NONBLOCK for instance). */
+
+ if (flags != 0)
+ {
+ __set_errno (EOPNOTSUPP);
+ return -1;
+ }
+ return preadv (fd, vector, count, offset);
+}
+
+#endif
@@ -48,7 +48,9 @@ preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
# define OFF_T off64_t
# include <sysdeps/posix/preadv_common.c>
#endif
+libc_hidden_def (preadv64)
#ifdef __OFF_T_MATCHES_OFF64_T
strong_alias (preadv64, preadv)
+libc_hidden_def (preadv)
#endif
new file mode 100644
@@ -0,0 +1,55 @@
+/* Linux implementation of preadv2 (LFS version).
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+#include <sysdep-cancel.h>
+
+#if !defined(__NR_preadv64v2) && defined(__NR_preadv2)
+# define __NR_preadv64v2 __NR_preadv2
+#endif
+
+ssize_t
+preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
+ int flags)
+{
+#ifdef __NR_preadv64v2
+ ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
+ LO_HI_LONG (offset), flags);
+ if (result >= 0 || errno != ENOSYS)
+ return result;
+#endif
+ /* Trying to emulate the preadv2 syscall flags is troublesome:
+
+ * We can not temporary change the file state of the O_DSYNC and O_SYNC
+ flags to emulate RWF_{D}SYNC (attempts to change the state of using
+ fcntl are silently ignored).
+
+ * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
+ semantic not provided by any other flag (O_NONBLOCK for instance). */
+
+ if (flags != 0)
+ {
+ __set_errno (EOPNOTSUPP);
+ return -1;
+ }
+ return preadv64 (fd, vector, count, offset);
+}
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+strong_alias (preadv64v2, preadv2)
+#endif
@@ -28,6 +28,7 @@ __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
{
return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL64_PRW (offset));
}
+
weak_alias (__libc_pwrite64, __pwrite64)
libc_hidden_weak (__pwrite64)
weak_alias (__libc_pwrite64, pwrite64)
@@ -50,4 +50,6 @@ pwritev (int fd, const struct iovec *vector, int count, off_t offset)
# define OFF_T off_t
# include <sysdeps/posix/pwritev_common.c>
# endif /* __ASSUME_PREADV */
+
+libc_hidden_def (pwritev)
#endif
new file mode 100644
@@ -0,0 +1,51 @@
+/* Linux implementation of pwritev2.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+#include <sysdep-cancel.h>
+
+#ifndef __OFF_T_MATCHES_OFF64_T
+
+ssize_t
+pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
+ int flags)
+{
+# ifdef __NR_pwritev2
+ ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
+ LO_HI_LONG (offset), flags);
+ if (result >= 0 || errno != ENOSYS)
+ return result;
+# endif
+ /* Trying to emulate the pwritev2 syscall flags is troublesome:
+
+ * We can not temporary change the file state of the O_DSYNC and O_SYNC
+ flags to emulate RWF_{D}SYNC (attempts to change the state of using
+ fcntl are silently ignored).
+
+ * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
+ semantic not provided by any other flag (O_NONBLOCK for instance). */
+
+ if (flags != 0)
+ {
+ __set_errno (EOPNOTSUPP);
+ return -1;
+ }
+ return pwritev (fd, vector, count, offset);
+}
+
+#endif
@@ -48,7 +48,9 @@ pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
# define OFF_T off64_t
# include <sysdeps/posix/pwritev_common.c>
#endif
+libc_hidden_def (pwritev64)
#ifdef __OFF_T_MATCHES_OFF64_T
strong_alias (pwritev64, pwritev)
+libc_hidden_def (pwritev)
#endif
new file mode 100644
@@ -0,0 +1,55 @@
+/* Linux implementation of pwritev2 (LFS version).
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+#include <sysdep-cancel.h>
+
+#if !defined(__NR_pwritev64v2) && defined(__NR_pwritev2)
+# define __NR_pwritev64v2 __NR_pwritev2
+#endif
+
+ssize_t
+pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
+ int flags)
+{
+#ifdef __NR_pwritev64v2
+ ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
+ LO_HI_LONG (offset), flags);
+ if (result >= 0 || errno != ENOSYS)
+ return result;
+#endif
+ /* Trying to emulate the pwritev2 syscall flags is troublesome:
+
+ * We can not temporary change the file state of the O_DSYNC and O_SYNC
+ flags to emulate RWF_{D}SYNC (attempts to change the state of using
+ fcntl are silently ignored).
+
+ * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
+ semantic not provided by any other flag (O_NONBLOCK for instance). */
+
+ if (flags != 0)
+ {
+ __set_errno (EOPNOTSUPP);
+ return -1;
+ }
+ return pwritev64 (fd, vector, count, offset);
+}
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+strong_alias (pwritev64v2, pwritev2)
+#endif
@@ -1980,6 +1980,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -1881,6 +1881,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -1866,6 +1866,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -1972,6 +1972,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -1910,6 +1910,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
@@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
@@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
@@ -1861,6 +1861,11 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F
GLIBC_2.3 GLIBC_2.3 A
GLIBC_2.3 __ctype_b_loc F
GLIBC_2.3 __ctype_tolower_loc F
@@ -2104,3 +2104,8 @@ GLIBC_2.25 getrandom F
GLIBC_2.25 strfromd F
GLIBC_2.25 strfromf F
GLIBC_2.25 strfroml F
+GLIBC_2.26 GLIBC_2.26 A
+GLIBC_2.26 preadv2 F
+GLIBC_2.26 preadv64v2 F
+GLIBC_2.26 pwritev2 F
+GLIBC_2.26 pwritev64v2 F