1 /* Copyright (C) 1991-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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 <https://www.gnu.org/licenses/>. */
22 #include <sys/types.h>
23 #include <bits/types/struct_iovec.h>
24 #include <bits/uio_lim.h>
26 # define UIO_MAXIOV __IOV_MAX
33 /* Read data from file descriptor FD, and put the result in the
34 buffers described by IOVEC, which is a vector of COUNT 'struct iovec's.
35 The buffers are filled in the order specified.
36 Operates just like 'read' (see <unistd.h>) except that data are
37 put in IOVEC instead of a contiguous buffer.
39 This function is a cancellation point and therefore not marked with
41 extern ssize_t
readv (int __fd
, const struct iovec
*__iovec
, int __count
)
42 __wur
__attr_access ((__read_only__
, 2, 3));
44 /* Write data pointed by the buffers described by IOVEC, which
45 is a vector of COUNT 'struct iovec's, to file descriptor FD.
46 The data is written in the order specified.
47 Operates just like 'write' (see <unistd.h>) except that the data
48 are taken from IOVEC instead of a contiguous buffer.
50 This function is a cancellation point and therefore not marked with
52 extern ssize_t
writev (int __fd
, const struct iovec
*__iovec
, int __count
)
53 __wur
__attr_access ((__read_only__
, 2, 3));
57 # ifndef __USE_FILE_OFFSET64
58 /* Read data from file descriptor FD at the given position OFFSET
59 without change the file pointer, and put the result in the buffers
60 described by IOVEC, which is a vector of COUNT 'struct iovec's.
61 The buffers are filled in the order specified. Operates just like
62 'pread' (see <unistd.h>) except that data are put in IOVEC instead
63 of a contiguous buffer.
65 This function is a cancellation point and therefore not marked with
67 extern ssize_t
preadv (int __fd
, const struct iovec
*__iovec
, int __count
,
69 __wur
__attr_access ((__read_only__
, 2, 3));
71 /* Write data pointed by the buffers described by IOVEC, which is a
72 vector of COUNT 'struct iovec's, to file descriptor FD at the given
73 position OFFSET without change the file pointer. The data is
74 written in the order specified. Operates just like 'pwrite' (see
75 <unistd.h>) except that the data are taken from IOVEC instead of a
78 This function is a cancellation point and therefore not marked with
80 extern ssize_t
pwritev (int __fd
, const struct iovec
*__iovec
, int __count
,
82 __wur
__attr_access ((__read_only__
, 2, 3));
86 extern ssize_t
__REDIRECT (preadv
, (int __fd
, const struct iovec
*__iovec
,
87 int __count
, __off64_t __offset
),
89 __wur
__attr_access ((__read_only__
, 2, 3));
90 extern ssize_t
__REDIRECT (pwritev
, (int __fd
, const struct iovec
*__iovec
,
91 int __count
, __off64_t __offset
),
93 __wur
__attr_access ((__read_only__
, 2, 3));
95 # define preadv preadv64
96 # define pwritev pwritev64
100 # ifdef __USE_LARGEFILE64
101 /* Read data from file descriptor FD at the given position OFFSET
102 without change the file pointer, and put the result in the buffers
103 described by IOVEC, which is a vector of COUNT 'struct iovec's.
104 The buffers are filled in the order specified. Operates just like
105 'pread' (see <unistd.h>) except that data are put in IOVEC instead
106 of a contiguous buffer.
108 This function is a cancellation point and therefore not marked with
110 extern ssize_t
preadv64 (int __fd
, const struct iovec
*__iovec
, int __count
,
112 __wur
__attr_access ((__read_only__
, 2, 3));
114 /* Write data pointed by the buffers described by IOVEC, which is a
115 vector of COUNT 'struct iovec's, to file descriptor FD at the given
116 position OFFSET without change the file pointer. The data is
117 written in the order specified. Operates just like 'pwrite' (see
118 <unistd.h>) except that the data are taken from IOVEC instead of a
121 This function is a cancellation point and therefore not marked with
123 extern ssize_t
pwritev64 (int __fd
, const struct iovec
*__iovec
, int __count
,
125 __wur
__attr_access ((__read_only__
, 2, 3));
127 #endif /* Use misc. */
131 # ifndef __USE_FILE_OFFSET64
132 /* Same as preadv but with an additional flag argumenti defined at uio.h. */
133 extern ssize_t
preadv2 (int __fp
, const struct iovec
*__iovec
, int __count
,
134 __off_t __offset
, int ___flags
)
135 __wur
__attr_access ((__read_only__
, 2, 3));
137 /* Same as preadv but with an additional flag argument defined at uio.h. */
138 extern ssize_t
pwritev2 (int __fd
, const struct iovec
*__iodev
, int __count
,
139 __off_t __offset
, int __flags
) __wur
;
143 extern ssize_t
__REDIRECT (pwritev2
, (int __fd
, const struct iovec
*__iovec
,
144 int __count
, __off64_t __offset
,
147 __wur
__attr_access ((__read_only__
, 2, 3));
148 extern ssize_t
__REDIRECT (preadv2
, (int __fd
, const struct iovec
*__iovec
,
149 int __count
, __off64_t __offset
,
152 __wur
__attr_access ((__read_only__
, 2, 3));
154 # define preadv2 preadv64v2
155 # define pwritev2 pwritev64v2
159 # ifdef __USE_LARGEFILE64
160 /* Same as preadv but with an additional flag argumenti defined at uio.h. */
161 extern ssize_t
preadv64v2 (int __fp
, const struct iovec
*__iovec
,
162 int __count
, __off64_t __offset
,
164 __wur
__attr_access ((__read_only__
, 2, 3));
166 /* Same as preadv but with an additional flag argument defined at uio.h. */
167 extern ssize_t
pwritev64v2 (int __fd
, const struct iovec
*__iodev
,
168 int __count
, __off64_t __offset
,
170 __wur
__attr_access ((__read_only__
, 2, 3));
172 #endif /* Use GNU. */
176 /* Some operating systems provide system-specific extensions to this
179 # include <bits/uio-ext.h>
182 #endif /* sys/uio.h */