diff options
Diffstat (limited to 'sysdeps/unix')
39 files changed, 348 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index a494c3947d..81e4fe9d9c 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -2098,4 +2098,8 @@ 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.26 reallocarray F diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist index 2fc1a9bae7..fab73317ca 100644 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist @@ -2009,6 +2009,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_loc F diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist index 4465a62ff1..d2a206a8df 100644 --- a/sysdeps/unix/sysv/linux/arm/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/libc.abilist @@ -99,6 +99,10 @@ 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.26 reallocarray F GLIBC_2.4 GLIBC_2.4 A GLIBC_2.4 _Exit F diff --git a/sysdeps/unix/sysv/linux/bits/uio.h b/sysdeps/unix/sysv/linux/bits/uio.h index 1583f0455b..d5701f8171 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 96126d9e6a..24bb7300d3 100644 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist @@ -1863,6 +1863,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_loc F diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist index aae351bbff..2ff1998ac9 100644 --- a/sysdeps/unix/sysv/linux/i386/libc.abilist +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist @@ -2021,6 +2021,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_loc F diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist index 81ec65bec0..39ccf2b5ee 100644 --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist @@ -1885,6 +1885,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_loc F diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 8961e4dd78..9495db4fef 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -97,3 +97,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 9db205b68e..b594ebd7c6 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist @@ -100,6 +100,10 @@ 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.26 reallocarray F GLIBC_2.4 GLIBC_2.4 A GLIBC_2.4 _Exit F diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist index ee59e950b6..a36739d41c 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist @@ -1977,6 +1977,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_loc F diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist index feb869757c..16aa25485f 100644 --- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist @@ -2098,4 +2098,8 @@ 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.26 reallocarray F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist index a5b1c42929..907ab331f2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist @@ -1952,6 +1952,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_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 570a859aac..36ee235d71 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist @@ -1950,6 +1950,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_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 71008ad873..783aa73ab7 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist @@ -1948,6 +1948,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_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 1a07d66caf..e1275dfe28 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist @@ -1943,6 +1943,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_loc F diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist index a62a41be62..be252287d1 100644 --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist @@ -2139,4 +2139,8 @@ 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.26 reallocarray F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist index f4f11dc625..e213895c71 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist @@ -1981,6 +1981,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_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 2977569f2c..d25aefd1ae 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist @@ -1986,6 +1986,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_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 271d32e19b..443d89f663 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist @@ -2186,4 +2186,8 @@ 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.26 reallocarray F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist index 372ef67c27..5eb056baf5 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist @@ -100,6 +100,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 _Exit F diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c index 7d971cc7b3..ecabc8c9c6 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 0000000000..11fe85eaa8 --- /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 66daa74ded..c96b2142e3 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 0000000000..9d7f8c9893 --- /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 57e5d20328..71959c0de2 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 ce02996a0b..7545cb3e1e 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 0000000000..72f0471f96 --- /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 45fb90b0d7..9dc4e55f96 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 0000000000..def9a0bc57 --- /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 705ff851a9..63d33e8b37 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist @@ -1981,6 +1981,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_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 21fd2b5671..b1b2b29c94 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist @@ -1882,6 +1882,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_loc F diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist index 313a71e589..f3a70a0f6f 100644 --- a/sysdeps/unix/sysv/linux/sh/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/libc.abilist @@ -1867,6 +1867,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_loc F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist index 94a4fb2213..8c4c2e502c 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist @@ -1973,6 +1973,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_loc F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist index 6db5811c3f..1653164d9e 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist @@ -1911,6 +1911,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_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 5d83926aac..41647d4610 100644 --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist @@ -2105,4 +2105,8 @@ 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.26 reallocarray F diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist index ce14ceb15f..1088923e59 100644 --- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist +++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist @@ -2105,4 +2105,8 @@ 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.26 reallocarray F diff --git a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist index 5d83926aac..41647d4610 100644 --- a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist +++ b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist @@ -2105,4 +2105,8 @@ 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.26 reallocarray F diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist index f69de7aa83..513524d932 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist @@ -1862,6 +1862,10 @@ 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.26 reallocarray F GLIBC_2.3 GLIBC_2.3 A GLIBC_2.3 __ctype_b_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 a330855308..0c557e9f43 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist @@ -2105,4 +2105,8 @@ 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.26 reallocarray F |