1lio_listio(3C)           Standard C Library Functions           lio_listio(3C)
2
3
4

NAME

6       lio_listio - list directed I/O
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUES

89       If  the mode argument has the value  LIO_NOWAIT, and the I/O operations
90       are successfully queued, lio_listio() returns 0; otherwise, it  returns
91       −1, and sets errno to indicate the error.
92
93
94       If  the    mode  argument has the value LIO_WAIT, and all the indicated
95       I/O has completed successfully, lio_listio() returns   0; otherwise, it
96       returns  −1, and sets errno to indicate the error.
97
98
99       In  either case, the return value only indicates the success or failure
100       of the lio_listio() call itself, not the status of the  individual  I/O
101       requests.  In  some cases, one or more of the I/O requests contained in
102       the list may fail. Failure of an individual request  does  not  prevent
103       completion  of any other  individual request.  To determine the outcome
104       of each I/O request, the application  must  examine  the  error  status
105       associated  with  each  aiocb  control  block.   Each  error  status so
106       returned is identical to that returned as a result of  an  aio_read(3C)
107       or aio_write(3C) function.
108

ERRORS

110       The lio_listio() function will fail if:
111
112       EAGAIN    The  resources  necessary  to queue all the I/O requests were
113                 not available. The error status for each request is  recorded
114                 in the aio_error member of the corresponding aiocb structure,
115                 and can be retrieved using aio_error(3C).
116
117
118       EAGAIN    The number of entries indicated by nent would cause the  sys‐
119                 tem-wide limit AIO_MAX to be exceeded.
120
121
122       EINVAL    The  mode argument is an improper value, or the value of nent
123                 is greater than AIO_LISTIO_MAX.
124
125
126       EINTR     A signal was delivered while waiting for all I/O requests  to
127                 complete  during an LIO_WAIT operation. Note that, since each
128                 I/O operation invoked by lio_listio() may possibly provoke  a
129                 signal  when it completes, this error return may be caused by
130                 the completion of one (or more) of the  very  I/O  operations
131                 being awaited. Outstanding I/O requests are not canceled, and
132                 the application can use aio_fsync(3C)  to  determine  if  any
133                 request  was  initiated;  aio_return(3C)  to determine if any
134                 request has completed; or aio_error(3C) to determine  if  any
135                 request was canceled.
136
137
138       EIO       One  or  more  of  the  individual I/O operations failed. The
139                 application can use  aio_error(3C) to check the error  status
140                 for   each   aiocb  structure  to  determine  the  individual
141                 request(s) that failed.
142
143
144
145       In addition to the errors returned by the lio_listio() function, if the
146       lio_listio()  function  succeeds or fails with errors of EAGAIN, EINTR,
147       or EIO, then some of the I/O specified by the list may have been initi‐
148       ated.  If the lio_listio() function fails with an error code other than
149       EAGAIN, EINTR, or EIO, no operations from the list have been initiated.
150       The  I/O  operation indicated by each list element can encounter errors
151       specific to the individual read or write function being  performed.  In
152       this  event, the error status for each aiocb control block contains the
153       associated error code. The error codes that can be set are the same  as
154       would  be  set  by  a  read(2) or write(2) function, with the following
155       additional error codes possible:
156
157       EAGAIN         The requested  I/O  operation  was  not  queued  due  to
158                      resource limitations.
159
160
161       ECANCELED      The  requested I/O was canceled before the I/O completed
162                      due to an explicit aio_cancel(3C) request.
163
164
165       EFBIG          The aiocbpaio_lio_opcode is LIO_WRITE, the  file  is  a
166                      regular  file,  aiocbpaio_nbytes is greater than 0, and
167                      the aiocbpaio_offset is greater than or  equal  to  the
168                      offset  maximum  in the open file description associated
169                      with aiocbpaio_fildes.
170
171
172       EINPROGRESS    The requested I/O is in progress.
173
174
175       EOVERFLOW      The aiocbpaio_lio_opcode is LIO_READ,  the  file  is  a
176                      regular  file,  aiocbpaio_nbytes is greater than 0, and
177                      the aiocbpaio_offset is before the end-of-file  and  is
178                      greater  than or equal to the offset maximum in the open
179                      file description associated with aiocbpaio_fildes.
180
181

USAGE

183       The lio_listio() function has a transitional interface for 64-bit  file
184       offsets.  See lf64(5).
185

ATTRIBUTES

187       See attributes(5) for descriptions of the following attributes:
188
189
190
191
192       ┌─────────────────────────────┬─────────────────────────────┐
193       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
194       ├─────────────────────────────┼─────────────────────────────┤
195       │Interface Stability          │Committed                    │
196       ├─────────────────────────────┼─────────────────────────────┤
197       │MT-Level                     │MT-Safe                      │
198       ├─────────────────────────────┼─────────────────────────────┤
199       │Standard                     │See standards(5).            │
200       └─────────────────────────────┴─────────────────────────────┘
201

SEE ALSO

203       close(2),  exec(2),  exit(2),  fork(2),  lseek(2),  read(2),  write(2),
204       aio_cancel(3C),     aio_error(3C),     aio_fsync(3C),     aio_read(3C),
205       aio_return(3C),   aio_write(3C),   aio.h(3HEAD),  fcntl.h(3HEAD),  sig‐
206       info.h(3HEAD), signal.h(3HEAD), attributes(5), lf64(5), standards(5)
207
208
209
210SunOS 5.11                        5 Feb 2008                    lio_listio(3C)
Impressum