1LIO_LISTIO(3P) POSIX Programmer's Manual LIO_LISTIO(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 lio_listio - list directed I/O (REALTIME)
13
15 #include <aio.h>
16
17 int lio_listio(int mode, struct aiocb *restrict const list[restrict],
18 int nent, struct sigevent *restrict sig);
19
20
22 The lio_listio() function shall initiate a list of I/O requests with a
23 single function call.
24
25 The mode argument takes one of the values LIO_WAIT or LIO_NOWAIT
26 declared in <aio.h> and determines whether the function returns when
27 the I/O operations have been completed, or as soon as the operations
28 have been queued. If the mode argument is LIO_WAIT, the function shall
29 wait until all I/O is complete and the sig argument shall be ignored.
30
31 If the mode argument is LIO_NOWAIT, the function shall return immedi‐
32 ately, and asynchronous notification shall occur, according to the sig
33 argument, when all the I/O operations complete. If sig is NULL, then
34 no asynchronous notification shall occur. If sig is not NULL, asynchro‐
35 nous notification occurs as specified in Signal Generation and Delivery
36 when all the requests in list have completed.
37
38 The I/O requests enumerated by list are submitted in an unspecified
39 order.
40
41 The list argument is an array of pointers to aiocb structures. The
42 array contains nent elements. The array may contain NULL elements,
43 which shall be ignored.
44
45 The aio_lio_opcode field of each aiocb structure specifies the opera‐
46 tion to be performed. The supported operations are LIO_READ, LIO_WRITE,
47 and LIO_NOP; these symbols are defined in <aio.h>. The LIO_NOP opera‐
48 tion causes the list entry to be ignored. If the aio_lio_opcode element
49 is equal to LIO_READ, then an I/O operation is submitted as if by a
50 call to aio_read() with the aiocbp equal to the address of the aiocb
51 structure. If the aio_lio_opcode element is equal to LIO_WRITE, then an
52 I/O operation is submitted as if by a call to aio_write() with the
53 aiocbp equal to the address of the aiocb structure.
54
55 The aio_fildes member specifies the file descriptor on which the opera‐
56 tion is to be performed.
57
58 The aio_buf member specifies the address of the buffer to or from which
59 the data is transferred.
60
61 The aio_nbytes member specifies the number of bytes of data to be
62 transferred.
63
64 The members of the aiocb structure further describe the I/O operation
65 to be performed, in a manner identical to that of the corresponding
66 aiocb structure when used by the aio_read() and aio_write() functions.
67
68 The nent argument specifies how many elements are members of the list;
69 that is, the length of the array.
70
71 The behavior of this function is altered according to the definitions
72 of synchronized I/O data integrity completion and synchronized I/O file
73 integrity completion if synchronized I/O is enabled on the file associ‐
74 ated with aio_fildes.
75
76 For regular files, no data transfer shall occur past the offset maximum
77 established in the open file description associated with
78 aiocbp->aio_fildes.
79
81 If the mode argument has the value LIO_NOWAIT, the lio_listio() func‐
82 tion shall return the value zero if the I/O operations are successfully
83 queued; otherwise, the function shall return the value -1 and set errno
84 to indicate the error.
85
86 If the mode argument has the value LIO_WAIT, the lio_listio() function
87 shall return the value zero when all the indicated I/O has completed
88 successfully. Otherwise, lio_listio() shall return a value of -1 and
89 set errno to indicate the error.
90
91 In either case, the return value only indicates the success or failure
92 of the lio_listio() call itself, not the status of the individual I/O
93 requests. In some cases one or more of the I/O requests contained in
94 the list may fail. Failure of an individual request does not prevent
95 completion of any other individual request. To determine the outcome
96 of each I/O request, the application shall examine the error status
97 associated with each aiocb control block. The error statuses so
98 returned are identical to those returned as the result of an aio_read()
99 or aio_write() function.
100
102 The lio_listio() function shall fail if:
103
104 EAGAIN The resources necessary to queue all the I/O requests were not
105 available. The application may check the error status for each
106 aiocb to determine the individual request(s) that failed.
107
108 EAGAIN The number of entries indicated by nent would cause the system-
109 wide limit {AIO_MAX} to be exceeded.
110
111 EINVAL The mode argument is not a proper value, or the value of nent
112 was greater than {AIO_LISTIO_MAX}.
113
114 EINTR A signal was delivered while waiting for all I/O requests to
115 complete during an LIO_WAIT operation. Note that, since each I/O
116 operation invoked by lio_listio() may possibly provoke a signal
117 when it completes, this error return may be caused by the com‐
118 pletion of one (or more) of the very I/O operations being
119 awaited. Outstanding I/O requests are not canceled, and the
120 application shall examine each list element to determine whether
121 the request was initiated, canceled, or completed.
122
123 EIO One or more of the individual I/O operations failed. The appli‐
124 cation may check the error status for each aiocb structure to
125 determine the individual request(s) that failed.
126
127
128 In addition to the errors returned by the lio_listio() function, if the
129 lio_listio() function succeeds or fails with errors of [EAGAIN],
130 [EINTR], or [EIO], then some of the I/O specified by the list may have
131 been initiated. If the lio_listio() function fails with an error code
132 other than [EAGAIN], [EINTR], or [EIO], no operations from the list
133 shall have been initiated. The I/O operation indicated by each list
134 element can encounter errors specific to the individual read or write
135 function being performed. In this event, the error status for each
136 aiocb control block contains the associated error code. The error
137 codes that can be set are the same as would be set by a read() or
138 write() function, with the following additional error codes possible:
139
140 EAGAIN The requested I/O operation was not queued due to resource limi‐
141 tations.
142
143 ECANCELED
144 The requested I/O was canceled before the I/O completed due to
145 an explicit aio_cancel() request.
146
147 EFBIG The aiocbp->aio_lio_opcode is LIO_WRITE, the file is a regular
148 file, aiocbp->aio_nbytes is greater than 0, and the
149 aiocbp->aio_offset is greater than or equal to the offset maxi‐
150 mum in the open file description associated with
151 aiocbp->aio_fildes.
152
153 EINPROGRESS
154 The requested I/O is in progress.
155
156 EOVERFLOW
157 The aiocbp->aio_lio_opcode is LIO_READ, the file is a regular
158 file, aiocbp->aio_nbytes is greater than 0, and the
159 aiocbp->aio_offset is before the end-of-file and is greater than
160 or equal to the offset maximum in the open file description
161 associated with aiocbp->aio_fildes.
162
163
164 The following sections are informative.
165
167 None.
168
170 None.
171
173 Although it may appear that there are inconsistencies in the specified
174 circumstances for error codes, the [EIO] error condition applies when
175 any circumstance relating to an individual operation makes that opera‐
176 tion fail. This might be due to a badly formulated request (for exam‐
177 ple, the aio_lio_opcode field is invalid, and aio_error() returns [EIN‐
178 VAL]) or might arise from application behavior (for example, the file
179 descriptor is closed before the operation is initiated, and aio_error()
180 returns [EBADF]).
181
182 The limitation on the set of error codes returned when operations from
183 the list shall have been initiated enables applications to know when
184 operations have been started and whether aio_error() is valid for a
185 specific operation.
186
188 None.
189
191 aio_read(), aio_write(), aio_error(), aio_return(), aio_cancel(),
192 close(), exec(), exit(), fork(), lseek(), read(), the Base Definitions
193 volume of IEEE Std 1003.1-2001, <aio.h>
194
196 Portions of this text are reprinted and reproduced in electronic form
197 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
198 -- Portable Operating System Interface (POSIX), The Open Group Base
199 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
200 Electrical and Electronics Engineers, Inc and The Open Group. In the
201 event of any discrepancy between this version and the original IEEE and
202 The Open Group Standard, the original IEEE and The Open Group Standard
203 is the referee document. The original Standard can be obtained online
204 at http://www.opengroup.org/unix/online.html .
205
206
207
208IEEE/The Open Group 2003 LIO_LISTIO(3P)