source: trunk/packages/xen-3.1/xen-3.1/tools/libaio/man/lio_listio.3 @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 4.8 KB
Line 
1.TH  lio_listio 3 2002-09-12 "Linux 2.4" Linux AIO"
2.SH NAME
3lio_listio - List directed I/O
4.SH SYNOPSYS
5.B #include <errno.h>
6.br
7.B #include <libaio.h>
8.LP
9.BI "int lio_listio (int mode, struct aiocb *const list[], int nent, struct sigevent *sig)"
10.nf
11.SH DESCRIPTION
12
13Besides these functions with the more or less traditional interface,
14POSIX.1b also defines a function which can initiate more than one
15operation at a time, and which can handle freely mixed read and write
16operations.  It is therefore similar to a combination of
17.IR readv
18and
19.IR "writev"
20.
21
22The
23.IR "lio_listio"
24function can be used to enqueue an arbitrary
25number of read and write requests at one time.  The requests can all be
26meant for the same file, all for different files or every solution in
27between.
28
29.IR "lio_listio"
30gets the
31.IR "nent"
32requests from the array pointed to
33by
34.IR "list"
35.  The operation to be performed is determined by the
36.IR "aio_lio_opcode"
37member in each element of
38.IR "list"
39.  If this
40field is
41.B "LIO_READ"
42a read operation is enqueued, similar to a call
43of
44.IR "aio_read"
45for this element of the array (except that the way
46the termination is signalled is different, as we will see below).  If
47the
48.IR "aio_lio_opcode"
49member is
50.B "LIO_WRITE"
51a write operation
52is enqueued.  Otherwise the
53.IR "aio_lio_opcode"
54must be
55.B "LIO_NOP"
56in which case this element of
57.IR "list"
58is simply ignored.  This
59``operation'' is useful in situations where one has a fixed array of
60.IR "struct aiocb"
61elements from which only a few need to be handled at
62a time.  Another situation is where the
63.IR "lio_listio"
64call was
65canceled before all requests are processed  and the remaining requests have to be reissued.
66
67The other members of each element of the array pointed to by
68.IR "list"
69must have values suitable for the operation as described in
70the documentation for
71.IR "aio_read"
72and
73.IR "aio_write"
74above.
75
76The
77.IR "mode"
78argument determines how
79.IR "lio_listio"
80behaves after
81having enqueued all the requests.  If
82.IR "mode"
83is
84.B "LIO_WAIT"
85it
86waits until all requests terminated.  Otherwise
87.IR "mode"
88must be
89.B "LIO_NOWAIT"
90and in this case the function returns immediately after
91having enqueued all the requests.  In this case the caller gets a
92notification of the termination of all requests according to the
93.IR "sig"
94parameter.  If
95.IR "sig"
96is
97.B "NULL"
98no notification is
99send.  Otherwise a signal is sent or a thread is started, just as
100described in the description for
101.IR "aio_read"
102or
103.IR "aio_write"
104.
105
106When the sources are compiled with
107.B "_FILE_OFFSET_BITS == 64"
108, this
109function is in fact
110.IR "lio_listio64"
111since the LFS interface
112transparently replaces the normal implementation.
113.SH "RETURN VALUES"
114If
115.IR "mode"
116is
117.B "LIO_WAIT"
118, the return value of
119.IR "lio_listio"
120is
121.IR 0
122when all requests completed successfully.  Otherwise the
123function return
124.IR 1
125and
126.IR "errno"
127is set accordingly.  To find
128out which request or requests failed one has to use the
129.IR "aio_error"
130function on all the elements of the array
131.IR "list"
132.
133
134In case
135.IR "mode"
136is
137.B "LIO_NOWAIT"
138, the function returns
139.IR 0
140if
141all requests were enqueued correctly.  The current state of the requests
142can be found using
143.IR "aio_error"
144and
145.IR "aio_return"
146as described
147above.  If
148.IR "lio_listio"
149returns
150.IR -1
151in this mode, the
152global variable
153.IR "errno"
154is set accordingly.  If a request did not
155yet terminate, a call to
156.IR "aio_error"
157returns
158.B "EINPROGRESS"
159.  If
160the value is different, the request is finished and the error value (or
161
162.IR 0
163) is returned and the result of the operation can be retrieved
164using
165.IR "aio_return"
166.
167.SH ERRORS
168Possible values for
169.IR "errno"
170are:
171
172.TP
173.B EAGAIN
174The resources necessary to queue all the requests are not available at
175the moment.  The error status for each element of
176.IR "list"
177must be
178checked to determine which request failed.
179
180Another reason could be that the system wide limit of AIO requests is
181exceeded.  This cannot be the case for the implementation on GNU systems
182since no arbitrary limits exist.
183.TP
184.B EINVAL
185The
186.IR "mode"
187parameter is invalid or
188.IR "nent"
189is larger than
190.B "AIO_LISTIO_MAX"
191.
192.TP
193.B EIO
194One or more of the request's I/O operations failed.  The error status of
195each request should be checked to determine which one failed.
196.TP
197.B ENOSYS
198The
199.IR "lio_listio"
200function is not supported.
201.PP
202
203If the
204.IR "mode"
205parameter is
206.B "LIO_NOWAIT"
207and the caller cancels
208a request, the error status for this request returned by
209.IR "aio_error"
210is
211.B "ECANCELED"
212.
213.SH "SEE ALSO"
214.BR aio(3),
215.BR aio_cancel(3),
216.BR aio_cancel64(3),
217.BR aio_error(3),
218.BR aio_error64(3),
219.BR aio_fsync(3),
220.BR aio_fsync64(3),
221.BR aio_init(3),
222.BR aio_read(3),
223.BR aio_read64(3),
224.BR aio_return(3),
225.BR aio_return64(3),
226.BR aio_suspend(3),
227.BR aio_suspend64(3),
228.BR aio_write(3),
229.BR aio_write64(3)
Note: See TracBrowser for help on using the repository browser.