![]() |
![]() |
![]() |
Initiate a list of I/O requests
#include <aio.h> int lio_listio( int mode, struct aiocb* const list[], int nent, struct sigevent* sig );
libc
The lio_listio() function allows the calling process, LWP, or thread, to initiate a list of I/O requests within a single function call.
If mode is set to LIO_WAIT, lio_listio() behaves synchronously, waiting until all I/O is completed, and the sig argument is ignored.
If mode is set to LIO_NOWAIT, lio_listio() behaves asynchronously, returning immediately, and signal delivery occurs, according to the sig argument, when all the I/O operations from this function complete. If sig is NULL, or the sigev_signo member of the sigevent structure pointed to by sig is zero, then no signal delivery occurs. Otherwise, the signal number indicated by sigev_signo is delivered when all the requests in list have completed.
The list argument is an array of pointers to aiocb structures. This array consists of nent elements. The array may contain NULL pointers, which are ignored.
The aio_lio_opcode field of each aiocb structure in list specifies the operation to be performed (see <aio.h>):
The nent argument specifies the length of the array (i.e. the number of members in the list).
When mode has the value LIO_NOWAIT, a pointer to a signal control structure, sig, is used to define both the signal to be generated and how the calling process is notified upon I/O completion:
For regular files, no data transfer occurs past the offset maximum established in the open file description associated with aiocbp->aio_fildes.
The behavior of this function is altered according to the definitions of synchronized I/O data integrity completion and synchronized I/O file integrity completion if synchronized I/O is enabled on the file associated with aio_fildes. (see the definitions of O_DSYNC and O_SYNC in the description of fcntl().)
If the mode argument is LIO_NOWAIT, and the I/O operations are successfully queued, lio_listio() returns 0; otherwise, it returns -1, and sets errno.
If the mode argument is LIO_WAIT, and all the indicated I/O has completed successfully, lio_listio() returns 0; otherwise, it returns -1, and sets errno.
In either case, the return value indicates only the success or failure of the lio_listio() call itself, not the status of the individual I/O requests. In some cases, one or more of the I/O requests contained in the list may fail. Failure of an individual request doesn't prevent completion of any other individual request. To determine the outcome of each I/O request, the application must examine the error status associated with each aiocb control block. Each error status so returned is identical to that returned as a result of calling aio_read() or aio_write().
The number of entries, nent, exceeds the system-wide limit, _POSIX_AIO_MAX.
The value of nent is greater than _POSIX_AIO_LISTIO_MAX.
If either lio_listio() succeeds in queuing all of its requests, or errno is set to EAGAIN, EINTR, or EIO, then some of the I/O specified from the list may have been initiated. In this event, each aiocb structure contains errors specific to the read() or write() function being performed:
The following additional error codes may be set for each aiocb control block:
POSIX 1003.1 (Realtime Extensions)
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
aio_cancel(), aio_error(), aio_fsync(), aio_read(), aio_return(), aio_write(), close(), execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), exit(), fcntl(), fork(), lseek(), read(), sigevent, write()
![]() |
![]() |
![]() |