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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       lio_listio — list directed I/O
13

SYNOPSIS

15       #include <aio.h>
16
17       int lio_listio(int mode, struct aiocb *restrict const list[restrict],
18           int nent, struct sigevent *restrict sig);
19

DESCRIPTION

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

RETURN VALUE

94       If the mode argument has the value LIO_NOWAIT, the  lio_listio()  func‐
95       tion shall return the value zero if the I/O operations are successfully
96       queued; otherwise, the function shall return the value -1 and set errno
97       to indicate the error.
98
99       If  the mode argument has the value LIO_WAIT, the lio_listio() function
100       shall return the value zero when all the indicated  I/O  has  completed
101       successfully.  Otherwise,  lio_listio()  shall return a value of -1 and
102       set errno to indicate the error.
103
104       In either case, the return value only indicates the success or  failure
105       of  the  lio_listio() call itself, not the status of the individual I/O
106       requests. In some cases one or more of the I/O  requests  contained  in
107       the  list  may fail.  Failure of an individual request does not prevent
108       completion of any other individual request. To determine the outcome of
109       each  I/O request, the application shall examine the error status asso‐
110       ciated with each aiocb control block. The error  statuses  so  returned
111       are  identical  to  those  returned  as  the result of an aio_read() or
112       aio_write() function.
113

ERRORS

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

EXAMPLES

178       None.
179

APPLICATION USAGE

181       None.
182

RATIONALE

184       Although  it may appear that there are inconsistencies in the specified
185       circumstances for error codes, the [EIO] error condition  applies  when
186       any  circumstance relating to an individual operation makes that opera‐
187       tion fail. This might be due to a badly formulated request  (for  exam‐
188       ple, the aio_lio_opcode field is invalid, and aio_error() returns [EIN‐
189       VAL]) or might arise from application behavior (for example,  the  file
190       descriptor is closed before the operation is initiated, and aio_error()
191       returns [EBADF]).
192
193       The limitation on the set of error codes returned when operations  from
194       the  list  shall  have been initiated enables applications to know when
195       operations have been started and whether aio_error()  is  valid  for  a
196       specific operation.
197

FUTURE DIRECTIONS

199       None.
200

SEE ALSO

202       aio_read(),   aio_write(),   aio_error(),  aio_return(),  aio_cancel(),
203       close(), exec, exit(), fork(), lseek(), read()
204
205       The Base Definitions volume of POSIX.1‐2017, <aio.h>
206
208       Portions of this text are reprinted and reproduced in  electronic  form
209       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
210       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
211       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
212       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
213       event of any discrepancy between this version and the original IEEE and
214       The Open Group Standard, the original IEEE and The Open Group  Standard
215       is  the  referee document. The original Standard can be obtained online
216       at http://www.opengroup.org/unix/online.html .
217
218       Any typographical or formatting errors that appear  in  this  page  are
219       most likely to have been introduced during the conversion of the source
220       files to man page format. To report such errors,  see  https://www.ker
221       nel.org/doc/man-pages/reporting_bugs.html .
222
223
224
225IEEE/The Open Group                  2017                       LIO_LISTIO(3P)
Impressum