lio_listio - Initiate a list of asynchronous I/O requests
int lio_listio (
struct aiocb *list,
struct sigevent *sig );
The lio_listio function allows the calling process to initiate a list of I/O requests with a single function call. The mode argument determines whether the function returns after the I/O operations are complete or as soon as they have been queued.
The list argument is a pointer to an array of pointers to aiocb structures. The aio_lio_opcode field of each aiocb structure specifies the operation to be performed and can take any one of three values; LIO_READ, LIO_WRITE, and LIO_NOP as defined in the <aio.h> header file. Whether the operation is specified as a read or write operation, the list array element contains the address of the aiocb structure for that operation. If the list array element is NULL, that array element will be skipped. If the aio_lio_opcode is LIO_READ, the I/O operation is submitted as an aio_read operation. If the aio_lio_opcode is LIO_WRITE the I/O operation is submitted as an aio_write operation. If the aio_lio_opcode is LIO_NOP, the list entry is skipped.
The aio_fildes member of the aiocb structure specifies the file descriptor for the operation. The aio_buf member specifies the address of the data transfer buffer. The number of bytes to be transferred is specified in the aio_nbytes member.
The sig argument points to a sigevent structure, which contains the signal number of the signal to be sent upon completion of the asynchronous I/O operation. If you specify LIO_WAIT, the function waits until all I/O operations are completed and the sig argument is ignored. If you specify LIO_NOWAIT, and the sigev_notify element of the sigevent structure equals SIGEV_SIGNAL and sigev_signo does not equal zero, the signal is generated.
If the mode argument has the value LIO_NOWAIT, the lio_listio function returns the value zero if the I/O operations are successfully queued. Otherwise, the function returns -1 and sets errno to indicate the error type.
If the mode argument has the value LIO_WAIT, the lio_listio function returns the value zero when all the indicated I/O operations complete successfully. Otherwise, the function returns -1 and sets errno to indicate the error type.
In either case, the return value indicates only the success or failure of the lio_listio function call, not the status of 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 does not prevent completion of any other individual request. To determine the outcome of each I/O request, examine the error status associated with each lio_aiocb control block. These error statuses are identical to those returned as the result of an aio_read or aio_write function.
The address of the aiocb structure is used as a handle for retrieving error and return status of the asynchronous operation while it is in progress (equal to [EINPROGRESS]). The error codes returned are identical to those returned as the result of an aio_read or aio_write function.
If an error occurs, the only way to determine which operations were initiated is to check the aiocb by using the aio_error function.
The lio_listio function fails under the following conditions:
The number of entries indicated by nent would exceed the system limit of AIO_MAX.
Nent was greater than AIO_LISTIO_MAX.
aio_lio opcode is invalid.
If the aio_listio function succeeds or fails with errors of [EAGAIN], [EINTR], or [EIO], then some of the I/O specified by the list may have been initiated. The I/O operation indicated by each list element can encounter errors specific to the individual read or write function being performed. In this event, the error status for each aiocb control block contains the asociated error code. These error codes are the same as for a call to the read or write function. One of the following additional errors may occur:
Functions: close(2), exec(2), _exit(2), fork(2), lseek(2), read(2), write(2), aio_cancel(3), aio_error(3), aio_group_completion_np(3), aio_read(3), aio_results_np(3), aio_return(3), aio_write(3). delim off