]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/preadv.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / preadv.c
1 /* Copyright (C) 2009-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18 #include <sys/uio.h>
19 #include <sysdep-cancel.h>
20
21 #ifndef __OFF_T_MATCHES_OFF64_T
22
23 # ifdef __ASSUME_PREADV
24
25 # ifndef __NR_preadv
26 # define __NR_preadv __NR_preadv64
27 # endif
28
29 ssize_t
30 preadv (int fd, const struct iovec *vector, int count, off_t offset)
31 {
32 return SYSCALL_CANCEL (preadv, fd, vector, count, LO_HI_LONG (offset));
33 }
34 # else
35 static ssize_t __atomic_preadv_replacement (int, const struct iovec *,
36 int, off_t) internal_function;
37 ssize_t
38 preadv (int fd, const struct iovec *vector, int count, off_t offset)
39 {
40 # ifdef __NR_preadv
41 ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,
42 LO_HI_LONG (offset));
43 if (result >= 0 || errno != ENOSYS)
44 return result;
45 # endif
46 return __atomic_preadv_replacement (fd, vector, count, offset);
47 }
48 # define PREADV static internal_function __atomic_preadv_replacement
49 # define PREAD __pread
50 # define OFF_T off_t
51 # include <sysdeps/posix/preadv.c>
52 # endif /* __ASSUME_PREADV */
53 #endif