]>
Commit | Line | Data |
---|---|---|
52bd9381 | 1 | /* Linux implementation of preadv2. |
581c785b | 2 | Copyright (C) 2017-2022 Free Software Foundation, Inc. |
52bd9381 AZ |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, see | |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
52bd9381 AZ |
18 | |
19 | #include <sys/uio.h> | |
20 | #include <sysdep-cancel.h> | |
21 | ||
22 | #ifndef __OFF_T_MATCHES_OFF64_T | |
23 | ||
52bd9381 AZ |
24 | ssize_t |
25 | preadv2 (int fd, const struct iovec *vector, int count, off_t offset, | |
26 | int flags) | |
27 | { | |
52bd9381 AZ |
28 | ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count, |
29 | LO_HI_LONG (offset), flags); | |
7a16bdbb | 30 | if (result >= 0 || errno != ENOSYS) |
52bd9381 | 31 | return result; |
b5350b48 | 32 | |
52bd9381 AZ |
33 | /* Trying to emulate the preadv2 syscall flags is troublesome: |
34 | ||
35 | * We can not temporary change the file state of the O_DSYNC and O_SYNC | |
36 | flags to emulate RWF_{D}SYNC (attempts to change the state of using | |
37 | fcntl are silently ignored). | |
38 | ||
39 | * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal | |
40 | semantic not provided by any other flag (O_NONBLOCK for instance). */ | |
41 | ||
42 | if (flags != 0) | |
43 | { | |
852d6312 | 44 | __set_errno (ENOTSUP); |
52bd9381 AZ |
45 | return -1; |
46 | } | |
d4b4a00a FW |
47 | if (offset == -1) |
48 | return __readv (fd, vector, count); | |
49 | else | |
50 | return preadv (fd, vector, count, offset); | |
52bd9381 AZ |
51 | } |
52 | ||
53 | #endif |