1LIO_LISTIO(3) Linux Programmer's Manual LIO_LISTIO(3)
2
3
4
6 lio_listio - initiate a list of I/O requests
7
9 #include <aio.h>
10
11 int lio_listio(int mode, struct aiocb *restrict const aiocb_list[restrict],
12 int nitems, struct sigevent *restrict sevp);
13
14 Link with -lrt.
15
17 The lio_listio() function initiates the list of I/O operations de‐
18 scribed by the array aiocb_list.
19
20 The mode operation has one of the following values:
21
22 LIO_WAIT
23 The call blocks until all operations are complete. The sevp ar‐
24 gument is ignored.
25
26 LIO_NOWAIT
27 The I/O operations are queued for processing and the call re‐
28 turns immediately. When all of the I/O operations complete,
29 asynchronous notification occurs, as specified by the sevp argu‐
30 ment; see sigevent(7) for details. If sevp is NULL, no asyn‐
31 chronous notification occurs.
32
33 The aiocb_list argument is an array of pointers to aiocb structures
34 that describe I/O operations. These operations are executed in an un‐
35 specified order. The nitems argument specifies the size of the array
36 aiocb_list. Null pointers in aiocb_list are ignored.
37
38 In each control block in aiocb_list, the aio_lio_opcode field specifies
39 the I/O operation to be initiated, as follows:
40
41 LIO_READ
42 Initiate a read operation. The operation is queued as for a
43 call to aio_read(3) specifying this control block.
44
45 LIO_WRITE
46 Initiate a write operation. The operation is queued as for a
47 call to aio_write(3) specifying this control block.
48
49 LIO_NOP
50 Ignore this control block.
51
52 The remaining fields in each control block have the same meanings as
53 for aio_read(3) and aio_write(3). The aio_sigevent fields of each con‐
54 trol block can be used to specify notifications for the individual I/O
55 operations (see sigevent(7)).
56
58 If mode is LIO_NOWAIT, lio_listio() returns 0 if all I/O operations are
59 successfully queued. Otherwise, -1 is returned, and errno is set to
60 indicate the error.
61
62 If mode is LIO_WAIT, lio_listio() returns 0 when all of the I/O opera‐
63 tions have completed successfully. Otherwise, -1 is returned, and er‐
64 rno is set to indicate the error.
65
66 The return status from lio_listio() provides information only about the
67 call itself, not about the individual I/O operations. One or more of
68 the I/O operations may fail, but this does not prevent other operations
69 completing. The status of individual I/O operations in aiocb_list can
70 be determined using aio_error(3). When an operation has completed, its
71 return status can be obtained using aio_return(3). Individual I/O op‐
72 erations can fail for the reasons described in aio_read(3) and
73 aio_write(3).
74
76 The lio_listio() function may fail for the following reasons:
77
78 EAGAIN Out of resources.
79
80 EAGAIN The number of I/O operations specified by nitems would cause the
81 limit AIO_MAX to be exceeded.
82
83 EINTR mode was LIO_WAIT and a signal was caught before all I/O opera‐
84 tions completed; see signal(7). (This may even be one of the
85 signals used for asynchronous I/O completion notification.)
86
87 EINVAL mode is invalid, or nitems exceeds the limit AIO_LISTIO_MAX.
88
89 EIO One of more of the operations specified by aiocb_list failed.
90 The application can check the status of each operation using
91 aio_return(3).
92
93 If lio_listio() fails with the error EAGAIN, EINTR, or EIO, then some
94 of the operations in aiocb_list may have been initiated. If lio_lis‐
95 tio() fails for any other reason, then none of the I/O operations has
96 been initiated.
97
99 The lio_listio() function is available since glibc 2.1.
100
102 For an explanation of the terms used in this section, see at‐
103 tributes(7).
104
105 ┌────────────────────────────────────────────┬───────────────┬─────────┐
106 │Interface │ Attribute │ Value │
107 ├────────────────────────────────────────────┼───────────────┼─────────┤
108 │lio_listio() │ Thread safety │ MT-Safe │
109 └────────────────────────────────────────────┴───────────────┴─────────┘
110
112 POSIX.1-2001, POSIX.1-2008.
113
115 It is a good idea to zero out the control blocks before use. The con‐
116 trol blocks must not be changed while the I/O operations are in
117 progress. The buffer areas being read into or written from must not be
118 accessed during the operations or undefined results may occur. The
119 memory areas involved must remain valid.
120
121 Simultaneous I/O operations specifying the same aiocb structure produce
122 undefined results.
123
125 aio_cancel(3), aio_error(3), aio_fsync(3), aio_return(3), aio_sus‐
126 pend(3), aio_write(3), aio(7)
127
129 This page is part of release 5.13 of the Linux man-pages project. A
130 description of the project, information about reporting bugs, and the
131 latest version of this page, can be found at
132 https://www.kernel.org/doc/man-pages/.
133
134
135
136 2021-03-22 LIO_LISTIO(3)