mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-30 08:40:07 +00:00
c79a72aa5c
Currently all architectures but microblaze use wire-up syscall for p{readv,write}v. Microblaze still uses the syscall emulation using sysdep/posix/p{readv,writev}.c and it was reported in some ocasions [1] [2] that it might have some issues with some linux specific usage (mainly with O_DIRECT and the alignment requirement). Although it is not an issue for virtually all the system, this patch refactors the sysdeps/posix p{read,write}v syscall to avoid such issue (by using posix_memalign on the buffer used on p{read,write} call) and by refactoring it common files to avoid the need check on defines to correct set the alias and internal symbols. Checked on microblaze-linux-gnu check with run-built-tests=no and by using the sysdeps/posix implementation on x86_64-linux-gnu (just for sanity test where it shown no regression). * sysdeps/posix/preadv.c: Use sysdeps/posix/preadv_common.c. * sysdeps/posix/preadv64.c: Likewise. * sysdeps/unix/sysv/linux/preadv.c: Likewise. * sysdeps/unix/sysv/linux/preadv64.c: Likewise. * sysdeps/posix/pwritev.c: Use sysdeps/posix/pwritev_common.c. * sysdeps/posix/pwritev64.c: Likewise. * sysdeps/unix/sysv/linux/pwritev.c: Likewise. * sysdeps/unix/sysv/linux/pwritev64.c: Likewise. * sysdeps/posix/preadv_common.c: New file. * sysdeps/posix/pwritev_common.c: Likewise. [1] http://www.mail-archive.com/qemu-devel@nongnu.org/msg25282.html [2] https://bugzilla.redhat.com/show_bug.cgi?id=563103#c8
55 lines
1.7 KiB
C
55 lines
1.7 KiB
C
/* 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/>. */
|
|
|
|
#include <sys/uio.h>
|
|
#include <sysdep-cancel.h>
|
|
|
|
#ifdef __ASSUME_PREADV
|
|
|
|
# ifndef __NR_preadv64
|
|
# define __NR_preadv64 __NR_preadv
|
|
# endif
|
|
|
|
ssize_t
|
|
preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
|
|
{
|
|
return SYSCALL_CANCEL (preadv64, fd, vector, count, LO_HI_LONG (offset));
|
|
}
|
|
#else
|
|
static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,
|
|
int, off64_t) internal_function;
|
|
ssize_t
|
|
preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
|
|
{
|
|
#ifdef __NR_preadv64
|
|
ssize_t result = SYSCALL_CANCEL (preadv64, fd, vector, count,
|
|
LO_HI_LONG (offset));
|
|
if (result >= 0 || errno != ENOSYS)
|
|
return result;
|
|
#endif
|
|
return __atomic_preadv64_replacement (fd, vector, count, offset);
|
|
}
|
|
# define PREADV static internal_function __atomic_preadv64_replacement
|
|
# define PREAD __pread64
|
|
# define OFF_T off64_t
|
|
# include <sysdeps/posix/preadv_common.c>
|
|
#endif
|
|
|
|
#ifdef __OFF_T_MATCHES_OFF64_T
|
|
strong_alias (preadv64, preadv)
|
|
#endif
|