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 EINVAL mode is invalid, or nitems exceeds the limit AIO_LISTIO_MAX.
79
80 EINTR mode was LIO_WAIT and a signal was caught before all I/O opera‐
81 tions completed. (This may even be one of the signals used for
82 asynchronous I/O completion notification.)
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 POSIX.1-2001, POSIX.1-2008.
98
100 It is a good idea to zero out the control blocks before use. The con‐
101 trol blocks must not be changed while the I/O operations are in
102 progress. The buffer areas being read into or written from must not be
103 accessed during the operations or undefined results may occur. The
104 memory areas involved must remain valid.
105
106 Simultaneous I/O operations specifying the same aiocb structure produce
107 undefined results.
108
110 aio_cancel(3), aio_error(3), aio_fsync(3), aio_return(3), aio_sus‐
111 pend(3), aio_write(3), aio(7)
112
114 This page is part of release 3.53 of the Linux man-pages project. A
115 description of the project, and information about reporting bugs, can
116 be found at http://www.kernel.org/doc/man-pages/.
117
118
119
120 2012-05-08 LIO_LISTIO(3)