summaryrefslogtreecommitdiffstats
path: root/man-pages-posix-2017/man3p/lio_listio.3p
blob: 3621e2092d7fb9b02d9521a06854a3a130b3030a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
'\" et
.TH LIO_LISTIO "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\"
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.\"
.SH NAME
lio_listio
\(em list directed I/O
.SH SYNOPSIS
.LP
.nf
#include <aio.h>
.P
int lio_listio(int \fImode\fP, struct aiocb *restrict const \fIlist\fP[restrict],
    int \fInent\fP, struct sigevent *restrict \fIsig\fP);
.fi
.SH DESCRIPTION
The
\fIlio_listio\fR()
function shall initiate a list of I/O requests with a single
function call.
.P
The
.IR mode
argument takes one of the values LIO_WAIT or LIO_NOWAIT declared in
.IR <aio.h> 
and determines whether the function returns when the I/O operations
have been completed, or as soon as the operations have been queued. If
the
.IR mode
argument is LIO_WAIT, the function shall wait until all I/O is
complete and the
.IR sig
argument shall be ignored.
.P
If the
.IR mode
argument is LIO_NOWAIT, the function shall return immediately, and
asynchronous notification shall occur, according to the
.IR sig
argument, when all the I/O operations complete. If
.IR sig
is NULL, then no asynchronous notification shall occur. If
.IR sig
is not NULL, asynchronous notification occurs as specified in
.IR "Section 2.4.1" ", " "Signal Generation and Delivery"
when all the requests in
.IR list
have completed.
.P
The I/O requests enumerated by
.IR list
are submitted in an unspecified order.
.P
The
.IR list
argument is an array of pointers to
.BR aiocb
structures. The array contains
.IR nent
elements. The array may contain NULL elements, which shall be ignored.
.P
If the buffer pointed to by
.IR list
or the
.BR aiocb
structures pointed to by the elements of the array
.IR list
become illegal addresses before all asynchronous I/O completed and, if
necessary, the notification is sent, then the behavior is undefined. If
the buffers pointed to by the
.IR aio_buf
member of the
.BR aiocb
structure pointed to by the elements of the array
.IR list
become illegal addresses prior to the asynchronous I/O associated with
that
.BR aiocb
structure being completed, the behavior is undefined.
.P
The
.IR aio_lio_opcode
field of each
.BR aiocb
structure specifies the operation to be performed. The supported
operations are LIO_READ, LIO_WRITE, and LIO_NOP;
these symbols are defined in
.IR <aio.h> .
The LIO_NOP operation causes the list entry to be ignored. If the
.IR aio_lio_opcode
element is equal to LIO_READ, then an I/O operation is submitted as if
by a call to
\fIaio_read\fR()
with the
.IR aiocbp
equal to the address of the
.BR aiocb
structure. If the
.IR aio_lio_opcode
element is equal to LIO_WRITE, then an I/O operation is submitted as if
by a call to
\fIaio_write\fR()
with the
.IR aiocbp
equal to the address of the
.BR aiocb
structure.
.P
The
.IR aio_fildes
member specifies the file descriptor on which the operation is to be
performed.
.P
The
.IR aio_buf
member specifies the address of the buffer to or from which the data is
transferred.
.P
The
.IR aio_nbytes
member specifies the number of bytes of data to be transferred.
.P
The members of the
.BR aiocb
structure further describe the I/O operation to be performed, in a
manner identical to that of the corresponding
.BR aiocb
structure when used by the
\fIaio_read\fR()
and
\fIaio_write\fR()
functions.
.P
The
.IR nent
argument specifies how many elements are members of the list; that is,
the length of the array.
.P
The behavior of this function is altered according to the definitions
of synchronized I/O data integrity completion and synchronized I/O file
integrity completion if synchronized I/O is enabled on the file
associated with
.IR aio_fildes .
.P
For regular files, no data transfer shall occur past the offset maximum
established in the open file description associated with
\fIaiocbp\fR\->\fIaio_fildes\fR.
.P
If \fIsig\fR\->\fIsigev_notify\fR is SIGEV_THREAD and
\fIsig\fR\->\fIsigev_notify_attributes\fR is a non-null pointer and the
block pointed to by this pointer becomes an illegal address prior to
all asynchronous I/O being completed, then the behavior is undefined.
.SH "RETURN VALUE"
If the
.IR mode
argument has the value LIO_NOWAIT, the
\fIlio_listio\fR()
function shall return the value zero if the I/O operations are
successfully queued; otherwise, the function shall return the value
\-1 and set
.IR errno
to indicate the error.
.P
If the
.IR mode
argument has the value LIO_WAIT, the
\fIlio_listio\fR()
function shall return the value zero when all the indicated I/O has
completed successfully. Otherwise,
\fIlio_listio\fR()
shall return a value of \-1 and set
.IR errno
to indicate the error.
.P
In either case, the return value only indicates the success or failure
of the
\fIlio_listio\fR()
call itself, not the status of the individual I/O requests. In some
cases one or more of the I/O requests contained in the list may fail.
Failure of an individual request does not prevent completion of any
other individual request. To determine the outcome of each I/O
request, the application shall examine the error status associated with
each
.BR aiocb
control block. The error statuses so returned are identical to those
returned as the result of an
\fIaio_read\fR()
or
\fIaio_write\fR()
function.
.SH ERRORS
The
\fIlio_listio\fR()
function shall fail if:
.TP
.BR EAGAIN
The resources necessary to queue all the I/O requests were not
available. The application may check the error status for each
.BR aiocb
to determine the individual request(s) that failed.
.TP
.BR EAGAIN
The number of entries indicated by
.IR nent
would cause the system-wide limit
{AIO_MAX}
to be exceeded.
.TP
.BR EINVAL
The
.IR mode
argument is not a proper value, or the value of
.IR nent
was greater than
{AIO_LISTIO_MAX}.
.TP
.BR EINTR
A signal was delivered while waiting for all I/O requests to complete
during an LIO_WAIT operation. Note that, since each I/O operation
invoked by
\fIlio_listio\fR()
may possibly provoke a signal when it completes, this error return may
be caused by the completion of one (or more) of the very I/O operations
being awaited. Outstanding I/O requests are not canceled, and the
application shall examine each list element to determine whether the
request was initiated, canceled, or completed.
.TP
.BR EIO
One or more of the individual I/O operations failed. The application
may check the error status for each
.BR aiocb
structure to determine the individual request(s) that failed.
.P
In addition to the errors returned by the
\fIlio_listio\fR()
function, if the
\fIlio_listio\fR()
function succeeds or fails with errors of
.BR [EAGAIN] ,
.BR [EINTR] ,
or
.BR [EIO] ,
then some of the I/O specified by the list may have been initiated. If
the
\fIlio_listio\fR()
function fails with an error code other than
.BR [EAGAIN] ,
.BR [EINTR] ,
or
.BR [EIO] ,
no operations from the list shall have been initiated. The I/O operation
indicated by each list element can encounter errors specific to the
individual read or write function being performed. In this event, the
error status for each
.BR aiocb
control block contains the associated error code. The error codes that
can be set are the same as would be set by a
\fIread\fR()
or
\fIwrite\fR()
function, with the following additional error codes possible:
.TP
.BR EAGAIN
The requested I/O operation was not queued due to resource limitations.
.TP
.BR ECANCELED
The requested I/O was canceled before the I/O completed due to an
explicit
\fIaio_cancel\fR()
request.
.TP
.BR EFBIG
The \fIaiocbp\fP\->\fIaio_lio_opcode\fP is LIO_WRITE, the file is a
regular file, \fIaiocbp\fP\->\fIaio_nbytes\fP is greater than 0, and
the \fIaiocbp\fP\->\fIaio_offset\fP is greater than or equal to the
offset maximum in the open file description associated with
\fIaiocbp\fP\->\fIaio_fildes\fP.
.TP
.BR EINPROGRESS
The requested I/O is in progress.
.TP
.BR EOVERFLOW
The \fIaiocbp\fP\->\fIaio_lio_opcode\fP is LIO_READ, the file is a
regular file, \fIaiocbp\fP\->\fIaio_nbytes\fP is greater than 0, and
the \fIaiocbp\fP\->\fIaio_offset\fP is before the end-of-file and is
greater than or equal to the offset maximum in the open file
description associated with \fIaiocbp\fP\->\fIaio_fildes\fP.
.LP
.IR "The following sections are informative."
.SH EXAMPLES
None.
.SH "APPLICATION USAGE"
None.
.SH RATIONALE
Although it may appear that there are inconsistencies in the specified
circumstances for error codes, the
.BR [EIO] 
error condition applies when any circumstance relating to an individual
operation makes that operation fail. This might be due to a badly
formulated request (for example, the
.IR aio_lio_opcode
field is invalid, and
\fIaio_error\fR()
returns
.BR [EINVAL] )
or might arise from application behavior (for example, the file
descriptor is closed before the operation is initiated, and
\fIaio_error\fR()
returns
.BR [EBADF] ).
.P
The limitation on the set of error codes returned when operations from
the list shall have been initiated enables applications to know when
operations have been started and whether
\fIaio_error\fR()
is valid for a specific operation.
.SH "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IR "\fIaio_read\fR\^(\|)",
.IR "\fIaio_write\fR\^(\|)",
.IR "\fIaio_error\fR\^(\|)",
.IR "\fIaio_return\fR\^(\|)",
.IR "\fIaio_cancel\fR\^(\|)",
.IR "\fIclose\fR\^(\|)",
.IR "\fIexec\fR\^",
.IR "\fIexit\fR\^(\|)",
.IR "\fIfork\fR\^(\|)",
.IR "\fIlseek\fR\^(\|)",
.IR "\fIread\fR\^(\|)"
.P
The Base Definitions volume of POSIX.1\(hy2017,
.IR "\fB<aio.h>\fP"
.\"
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1-2017, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 7, 2018 Edition,
Copyright (C) 2018 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
.PP
Any typographical or formatting errors that appear
in this page are most likely
to have been introduced during the conversion of the source files to
man page format. To report such errors, see
https://www.kernel.org/doc/man-pages/reporting_bugs.html .