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 a494c39..81e4fe9 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 2fc1a9b..fab7331 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 4465a62..d2a206a 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 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 96126d9..24bb730 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 aae351b..2ff1998 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 81ec65b..39ccf2b 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 8961e4d..9495db4 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 9db205b..b594ebd 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 ee59e95..a36739d 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 feb8697..16aa254 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 a5b1c42..907ab33 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 570a859..36ee235 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 71008ad..783aa73 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 1a07d66..e1275df 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 a62a41b..be25228 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 f4f11dc..e213895 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 2977569..d25aefd 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 271d32e..443d89f 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 372ef67..5eb056b 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 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 705ff85..63d33e8 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 21fd2b5..b1b2b29 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 313a71e..f3a70a0 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 94a4fb2..8c4c2e5 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 6db5811..1653164 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 5d83926..41647d4 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 ce14ceb..1088923 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 5d83926..41647d4 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 f69de7a..513524d 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 a330855..0c557e9 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 |