]>
Commit | Line | Data |
---|---|---|
52bd9381 | 1 | /* Linux implementation of pwritev2 (LFS version). |
6d7e8eda | 2 | Copyright (C) 2017-2023 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 | ||
52bd9381 AZ |
22 | ssize_t |
23 | pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset, | |
24 | int flags) | |
25 | { | |
b5350b48 | 26 | ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count, |
52bd9381 | 27 | LO_HI_LONG (offset), flags); |
7a16bdbb | 28 | if (result >= 0 || errno != ENOSYS) |
52bd9381 | 29 | return result; |
b5350b48 | 30 | |
52bd9381 AZ |
31 | /* Trying to emulate the pwritev2 syscall flags is troublesome: |
32 | ||
33 | * We can not temporary change the file state of the O_DSYNC and O_SYNC | |
34 | flags to emulate RWF_{D}SYNC (attempts to change the state of using | |
35 | fcntl are silently ignored). | |
36 | ||
37 | * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal | |
38 | semantic not provided by any other flag (O_NONBLOCK for instance). */ | |
39 | ||
40 | if (flags != 0) | |
41 | { | |
852d6312 | 42 | __set_errno (ENOTSUP); |
52bd9381 AZ |
43 | return -1; |
44 | } | |
d4b4a00a FW |
45 | if (offset == -1) |
46 | return __writev (fd, vector, count); | |
47 | else | |
48 | return pwritev64 (fd, vector, count, offset); | |
52bd9381 AZ |
49 | } |
50 | ||
51 | #ifdef __OFF_T_MATCHES_OFF64_T | |
52 | strong_alias (pwritev64v2, pwritev2) | |
53 | #endif |