]> git.ipfire.org Git - thirdparty/glibc.git/blame - misc/sys/uio.h
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / misc / sys / uio.h
CommitLineData
dff8da6b 1/* Copyright (C) 1991-2024 Free Software Foundation, Inc.
2c6fe0bd 2 This file is part of the GNU C Library.
28f540f4 3
2c6fe0bd 4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
28f540f4 8
2c6fe0bd
UD
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
41bdb6e2 12 Lesser General Public License for more details.
28f540f4 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
28f540f4
RM
17
18#ifndef _SYS_UIO_H
28f540f4 19#define _SYS_UIO_H 1
5107cf1d 20
28f540f4 21#include <features.h>
2c6fe0bd 22#include <sys/types.h>
37f802f8
ZW
23#include <bits/types/struct_iovec.h>
24#include <bits/uio_lim.h>
25#ifdef __IOV_MAX
26# define UIO_MAXIOV __IOV_MAX
27#else
28# undef UIO_MAXIOV
29#endif
28f540f4 30
84384f5b
UD
31__BEGIN_DECLS
32
28f540f4 33/* Read data from file descriptor FD, and put the result in the
e109c612 34 buffers described by IOVEC, which is a vector of COUNT 'struct iovec's.
28f540f4 35 The buffers are filled in the order specified.
e109c612 36 Operates just like 'read' (see <unistd.h>) except that data are
ce22661a 37 put in IOVEC instead of a contiguous buffer.
2c008571
UD
38
39 This function is a cancellation point and therefore not marked with
40 __THROW. */
a784e502 41extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count)
26492c0a 42 __wur __attr_access ((__read_only__, 2, 3));
28f540f4 43
ce22661a 44/* Write data pointed by the buffers described by IOVEC, which
e109c612 45 is a vector of COUNT 'struct iovec's, to file descriptor FD.
28f540f4 46 The data is written in the order specified.
e109c612 47 Operates just like 'write' (see <unistd.h>) except that the data
ce22661a 48 are taken from IOVEC instead of a contiguous buffer.
2c008571
UD
49
50 This function is a cancellation point and therefore not marked with
51 __THROW. */
a784e502 52extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count)
26492c0a 53 __wur __attr_access ((__read_only__, 2, 3));
e109c612
UD
54
55
498afc54 56#ifdef __USE_MISC
e109c612
UD
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
7f8a28ef 62 'pread' (see <unistd.h>) except that data are put in IOVEC instead
e109c612
UD
63 of a contiguous buffer.
64
65 This function is a cancellation point and therefore not marked with
66 __THROW. */
a784e502 67extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
26492c0a
MS
68 __off_t __offset)
69 __wur __attr_access ((__read_only__, 2, 3));
e109c612
UD
70
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
7f8a28ef 74 written in the order specified. Operates just like 'pwrite' (see
e109c612
UD
75 <unistd.h>) except that the data are taken from IOVEC instead of a
76 contiguous buffer.
77
78 This function is a cancellation point and therefore not marked with
79 __THROW. */
a784e502 80extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
26492c0a
MS
81 __off_t __offset)
82 __wur __attr_access ((__read_only__, 2, 3));
52bd9381 83
e109c612
UD
84# else
85# ifdef __REDIRECT
a784e502 86extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec,
34df851b 87 int __count, __off64_t __offset),
26492c0a
MS
88 preadv64)
89 __wur __attr_access ((__read_only__, 2, 3));
a784e502 90extern ssize_t __REDIRECT (pwritev, (int __fd, const struct iovec *__iovec,
34df851b 91 int __count, __off64_t __offset),
26492c0a
MS
92 pwritev64)
93 __wur __attr_access ((__read_only__, 2, 3));
e109c612
UD
94# else
95# define preadv preadv64
96# define pwritev pwritev64
97# endif
98# endif
99
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
7f8a28ef 105 'pread' (see <unistd.h>) except that data are put in IOVEC instead
e109c612
UD
106 of a contiguous buffer.
107
108 This function is a cancellation point and therefore not marked with
109 __THROW. */
a784e502 110extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count,
26492c0a
MS
111 __off64_t __offset)
112 __wur __attr_access ((__read_only__, 2, 3));
e109c612
UD
113
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
7f8a28ef 117 written in the order specified. Operates just like 'pwrite' (see
e109c612
UD
118 <unistd.h>) except that the data are taken from IOVEC instead of a
119 contiguous buffer.
120
121 This function is a cancellation point and therefore not marked with
122 __THROW. */
a784e502 123extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count,
26492c0a
MS
124 __off64_t __offset)
125 __wur __attr_access ((__read_only__, 2, 3));
e109c612 126# endif
acd7f096 127#endif /* Use misc. */
28f540f4 128
52bd9381
AZ
129
130#ifdef __USE_GNU
131# ifndef __USE_FILE_OFFSET64
132/* Same as preadv but with an additional flag argumenti defined at uio.h. */
133extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count,
26492c0a
MS
134 __off_t __offset, int ___flags)
135 __wur __attr_access ((__read_only__, 2, 3));
52bd9381
AZ
136
137/* Same as preadv but with an additional flag argument defined at uio.h. */
138extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count,
139 __off_t __offset, int __flags) __wur;
140
141# else
142# ifdef __REDIRECT
143extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec,
144 int __count, __off64_t __offset,
145 int __flags),
26492c0a
MS
146 pwritev64v2)
147 __wur __attr_access ((__read_only__, 2, 3));
52bd9381
AZ
148extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec,
149 int __count, __off64_t __offset,
150 int __flags),
26492c0a
MS
151 preadv64v2)
152 __wur __attr_access ((__read_only__, 2, 3));
52bd9381
AZ
153# else
154# define preadv2 preadv64v2
155# define pwritev2 pwritev64v2
156# endif
157# endif
158
159# ifdef __USE_LARGEFILE64
160/* Same as preadv but with an additional flag argumenti defined at uio.h. */
161extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec,
162 int __count, __off64_t __offset,
26492c0a
MS
163 int ___flags)
164 __wur __attr_access ((__read_only__, 2, 3));
52bd9381
AZ
165
166/* Same as preadv but with an additional flag argument defined at uio.h. */
167extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev,
168 int __count, __off64_t __offset,
26492c0a
MS
169 int __flags)
170 __wur __attr_access ((__read_only__, 2, 3));
52bd9381
AZ
171# endif
172#endif /* Use GNU. */
173
28f540f4
RM
174__END_DECLS
175
37f802f8
ZW
176/* Some operating systems provide system-specific extensions to this
177 header. */
178#ifdef __USE_GNU
179# include <bits/uio-ext.h>
180#endif
181
28f540f4 182#endif /* sys/uio.h */