1LIO_LISTIO(P)              POSIX Programmer's Manual             LIO_LISTIO(P)
2
3
4

NAME

6       lio_listio - list directed I/O (REALTIME)
7

SYNOPSIS

9       #include <aio.h>
10
11       int lio_listio(int mode, struct aiocb *restrict const list[restrict],
12              int nent, struct sigevent *restrict sig);
13
14

DESCRIPTION

16       The  lio_listio() function shall initiate a list of I/O requests with a
17       single function call.
18
19       The mode argument takes  one  of  the  values  LIO_WAIT  or  LIO_NOWAIT
20       declared  in  <aio.h>  and determines whether the function returns when
21       the I/O operations have been completed, or as soon  as  the  operations
22       have  been queued. If the mode argument is LIO_WAIT, the function shall
23       wait until all I/O is complete and the sig argument shall be ignored.
24
25       If the mode argument is LIO_NOWAIT, the function shall  return  immedi‐
26       ately,  and asynchronous notification shall occur, according to the sig
27       argument, when all the I/O operations complete.  If sig is  NULL,  then
28       no asynchronous notification shall occur. If sig is not NULL, asynchro‐
29       nous notification occurs as specified in Signal Generation and Delivery
30       when all the requests in list have completed.
31
32       The  I/O  requests  enumerated  by list are submitted in an unspecified
33       order.
34
35       The list argument is an array of pointers  to  aiocb  structures.   The
36       array  contains  nent  elements.  The  array may contain NULL elements,
37       which shall be ignored.
38
39       The aio_lio_opcode field of each aiocb structure specifies  the  opera‐
40       tion to be performed. The supported operations are LIO_READ, LIO_WRITE,
41       and LIO_NOP; these symbols are defined in <aio.h>. The  LIO_NOP  opera‐
42       tion causes the list entry to be ignored. If the aio_lio_opcode element
43       is equal to LIO_READ, then an I/O operation is submitted  as  if  by  a
44       call  to  aio_read()  with the aiocbp equal to the address of the aiocb
45       structure. If the aio_lio_opcode element is equal to LIO_WRITE, then an
46       I/O  operation  is  submitted  as  if by a call to aio_write() with the
47       aiocbp equal to the address of the aiocb structure.
48
49       The aio_fildes member specifies the file descriptor on which the opera‐
50       tion is to be performed.
51
52       The aio_buf member specifies the address of the buffer to or from which
53       the data is transferred.
54
55       The aio_nbytes member specifies the number  of  bytes  of  data  to  be
56       transferred.
57
58       The  members  of the aiocb structure further describe the I/O operation
59       to be performed, in a manner identical to  that  of  the  corresponding
60       aiocb structure when used by the aio_read() and aio_write() functions.
61
62       The  nent argument specifies how many elements are members of the list;
63       that is, the length of the array.
64
65       The behavior of this function is altered according to  the  definitions
66       of synchronized I/O data integrity completion and synchronized I/O file
67       integrity completion if synchronized I/O is enabled on the file associ‐
68       ated with aio_fildes.
69
70       For regular files, no data transfer shall occur past the offset maximum
71       established   in   the   open   file   description   associated    with
72       aiocbp->aio_fildes.
73

RETURN VALUE

75       If  the  mode argument has the value LIO_NOWAIT, the lio_listio() func‐
76       tion shall return the value zero if the I/O operations are successfully
77       queued; otherwise, the function shall return the value -1 and set errno
78       to indicate the error.
79
80       If the mode argument has the value LIO_WAIT, the lio_listio()  function
81       shall  return  the  value zero when all the indicated I/O has completed
82       successfully. Otherwise, lio_listio() shall return a value  of  -1  and
83       set errno to indicate the error.
84
85       In  either case, the return value only indicates the success or failure
86       of the lio_listio() call itself, not the status of the  individual  I/O
87       requests.  In  some  cases one or more of the I/O requests contained in
88       the list may fail. Failure of an individual request  does  not  prevent
89       completion  of  any other individual request.  To determine the outcome
90       of each I/O request, the application shall  examine  the  error  status
91       associated  with  each  aiocb  control  block.  The  error  statuses so
92       returned are identical to those returned as the result of an aio_read()
93       or aio_write() function.
94

ERRORS

96       The lio_listio() function shall fail if:
97
98       EAGAIN The  resources  necessary to queue all the I/O requests were not
99              available.  The application may check the error status for  each
100              aiocb to determine the individual request(s) that failed.
101
102       EAGAIN The  number of entries indicated by nent would cause the system-
103              wide limit {AIO_MAX} to be exceeded.
104
105       EINVAL The mode argument is not a proper value, or the  value  of  nent
106              was greater than {AIO_LISTIO_MAX}.
107
108       EINTR  A  signal  was  delivered  while waiting for all I/O requests to
109              complete during an LIO_WAIT operation. Note that, since each I/O
110              operation  invoked by lio_listio() may possibly provoke a signal
111              when it completes, this error return may be caused by  the  com‐
112              pletion  of  one  (or  more)  of  the  very I/O operations being
113              awaited.  Outstanding I/O requests are  not  canceled,  and  the
114              application shall examine each list element to determine whether
115              the request was initiated, canceled, or completed.
116
117       EIO    One or more of the individual I/O operations failed. The  appli‐
118              cation  may  check  the error status for each aiocb structure to
119              determine the individual request(s) that failed.
120
121
122       In addition to the errors returned by the lio_listio() function, if the
123       lio_listio()  function  succeeds  or  fails  with  errors  of [EAGAIN],
124       [EINTR], or [EIO], then some of the I/O specified by the list may  have
125       been  initiated.  If the lio_listio() function fails with an error code
126       other than [EAGAIN], [EINTR], or [EIO], no  operations  from  the  list
127       shall  have  been  initiated.  The I/O operation indicated by each list
128       element can encounter errors specific to the individual read  or  write
129       function  being  performed.  In  this  event, the error status for each
130       aiocb control block contains the  associated  error  code.   The  error
131       codes  that  can  be  set  are  the same as would be set by a read() or
132       write() function, with the following additional error codes possible:
133
134       EAGAIN The requested I/O operation was not queued due to resource limi‐
135              tations.
136
137       ECANCELED
138              The  requested  I/O was canceled before the I/O completed due to
139              an explicit aio_cancel() request.
140
141       EFBIG  The aiocbp->aio_lio_opcode is LIO_WRITE, the file is  a  regular
142              file,   aiocbp->aio_nbytes   is   greater   than   0,   and  the
143              aiocbp->aio_offset is greater than or equal to the offset  maxi‐
144              mum    in    the   open   file   description   associated   with
145              aiocbp->aio_fildes.
146
147       EINPROGRESS
148              The requested I/O is in progress.
149
150       EOVERFLOW
151              The aiocbp->aio_lio_opcode is LIO_READ, the file  is  a  regular
152              file,   aiocbp->aio_nbytes   is   greater   than   0,   and  the
153              aiocbp->aio_offset is before the end-of-file and is greater than
154              or  equal  to  the  offset  maximum in the open file description
155              associated with aiocbp->aio_fildes.
156
157
158       The following sections are informative.
159

EXAMPLES

161       None.
162

APPLICATION USAGE

164       None.
165

RATIONALE

167       Although it may appear that there are inconsistencies in the  specified
168       circumstances  for  error codes, the [EIO] error condition applies when
169       any circumstance relating to an individual operation makes that  opera‐
170       tion  fail.  This might be due to a badly formulated request (for exam‐
171       ple, the aio_lio_opcode field is invalid, and aio_error() returns [EIN‐
172       VAL])  or  might arise from application behavior (for example, the file
173       descriptor is closed before the operation is initiated, and aio_error()
174       returns [EBADF]).
175
176       The  limitation on the set of error codes returned when operations from
177       the list shall have been initiated enables applications  to  know  when
178       operations  have  been  started  and whether aio_error() is valid for a
179       specific operation.
180

FUTURE DIRECTIONS

182       None.
183

SEE ALSO

185       aio_read() , aio_write() , aio_error() , aio_return() , aio_cancel()  ,
186       close()  , exec() , exit() , fork() , lseek() , read() , the Base Defi‐
187       nitions volume of IEEE Std 1003.1-2001, <aio.h>
188
190       Portions of this text are reprinted and reproduced in  electronic  form
191       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
192       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
193       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
194       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
195       event of any discrepancy between this version and the original IEEE and
196       The Open Group Standard, the original IEEE and The Open Group  Standard
197       is  the  referee document. The original Standard can be obtained online
198       at http://www.opengroup.org/unix/online.html .
199
200
201
202IEEE/The Open Group                  2003                        LIO_LISTIO(P)
Impressum