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