glibc/sysdeps/posix
Adhemerval Zanella 52bd938169 posix: Implement preadv2 and pwritev2
This patch adds support of preadv2 and pwritev2 which are similar to
preadv/pwritev but with an extra flag argument.  As for preadv/pwritev
both interfaces are added a non-standard GNU API.

For 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 EOPNOTSUPP for any non
supported flag (which are none currently) calls generic preadv/pwritev.
Basically this implementation 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.
2017-05-31 17:35:46 -03:00
..
Makefile NPTL: Refactor named semaphore code to use shm-directory.h 2014-12-12 15:01:30 -08:00
Subdirs Make sysdeps/posix bring in login subdir. 2015-07-23 17:04:22 -07:00
alarm.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
clock.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
clock_getres.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
closedir.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
ctermid.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
cuserid.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
dirfd.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
dirstream.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
dl-fileid.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
dup.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
dup2.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
euidaccess.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
fdopendir.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
flock.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
fpathconf.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
gai_strerror-strs.h * sysdeps/posix/gai_strerror.c: Complete rewrite. Avoid relocations. 2005-12-20 17:53:00 +00:00
gai_strerror.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
getaddrinfo.c getaddrinfo: Unconditionally use malloc for address list 2017-05-11 10:01:49 +02:00
getcwd.c Assume that O_CLOEXEC is always defined and works 2017-04-18 14:56:51 +02:00
getdtsz.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
gethostname.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
getpagesize.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
gettimeofday.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
isatty.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
isfdtype.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
killpg.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
libc_fatal.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
mkfifo.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
mkfifoat.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
nice.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
open64.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
opendir.c Assume that O_CLOEXEC is always defined and works 2017-04-18 14:56:51 +02:00
pathconf.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
pause.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
posix_fallocate.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
posix_fallocate64.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
pread.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
pread64.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
preadv.c posix: Fix and simplify default p{read,write}v implementation 2017-05-15 16:33:45 -03:00
preadv2.c posix: Implement preadv2 and pwritev2 2017-05-31 17:35:46 -03:00
preadv64.c posix: Fix and simplify default p{read,write}v implementation 2017-05-15 16:33:45 -03:00
preadv64v2.c posix: Implement preadv2 and pwritev2 2017-05-31 17:35:46 -03:00
preadv_common.c posix: Fix and simplify default p{read,write}v implementation 2017-05-15 16:33:45 -03:00
profil.c Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
pwrite.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
pwrite64.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
pwritev.c posix: Fix and simplify default p{read,write}v implementation 2017-05-15 16:33:45 -03:00
pwritev2.c posix: Implement preadv2 and pwritev2 2017-05-31 17:35:46 -03:00
pwritev64.c posix: Fix and simplify default p{read,write}v implementation 2017-05-15 16:33:45 -03:00
pwritev64v2.c posix: Implement preadv2 and pwritev2 2017-05-31 17:35:46 -03:00
pwritev_common.c posix: Fix and simplify default p{read,write}v implementation 2017-05-15 16:33:45 -03:00
raise.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
readdir.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
readdir_r.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
readv.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
remove.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
rename.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
rewinddir.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
seekdir.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
shm-directory.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
shm-directory.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
shm_open.c Assume that O_CLOEXEC is always defined and works 2017-04-18 14:56:51 +02:00
shm_unlink.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sigblock.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sigignore.c Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
sigintr.c Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
signal.c Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
sigpause.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sigset.c Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
sigsetmask.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sigsuspend.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sigwait.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sleep.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
spawni.c [BZ 21340] add support for POSIX_SPAWN_SETSID 2017-04-25 08:51:12 -03:00
sprofil.c Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
sysconf.c timezone: Remove TZNAME_MAX limit from sysconf [BZ #15576] 2017-03-07 17:45:38 +01:00
system.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sysv_signal.c Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
telldir.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
tempname.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
time.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
timespec_get.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
truncate.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
ttyname.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
ttyname_r.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
ulimit.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
usleep.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
utime.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
utimes.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
wait.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
wait3.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
waitid.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
writev.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00