Manual Page Result
0
Command: lio_listio | Section: 3 | Source: Digital UNIX | File: lio_listio.3.gz
lio_listio(3) Library Functions Manual lio_listio(3)
NAME
lio_listio - Initiate a list of asynchronous I/O requests
SYNOPSIS
#include <aio.h>
int lio_listio ( int mode, struct aiocb *list[], int
nent, struct sigevent *sig );
PARAMETERS
Determines whether the lio_listio function returns when the I/O opera-
tions are completed or as soon as the operations are queued. The mode
argument can have a value of either LIO_WAIT or LIO_NOWAIT. A pointer
to an array of pointers to aiocb structures. The array contains nent
elements. The length of the array pointed to by the list argument. The
nent argument also specifies the number of I/O operations potentially
performed by the lio_listio function. A pointer to a sigevent struc-
ture.
DESCRIPTION
The lio_listio function allows the calling process to initiate a list
of I/O requests with a single function call. The mode argument deter-
mines whether the function returns after the I/O operations are com-
plete or as soon as they have been queued.
The list argument is a pointer to an array of pointers to aiocb struc-
tures. 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 de-
scriptor 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 asynchro-
nous 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.
RETURN VALUES
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 in-
dicate 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 re-
quests. 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 com-
pletion 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 identi-
cal to those returned as the result of an aio_read or aio_write func-
tion.
If an error occurs, the only way to determine which operations were
initiated is to check the aiocb by using the aio_error function.
ERRORS
The lio_listio function fails under the following conditions:
[EAGAIN] The resources necessary to queue all the I/O requests
were not available. The application may check the error
status for each aiocb to determine the individual re-
quest(s) that failed.
The number of entries indicated by nent would exceed the
system limit of AIO_MAX.
[EINTR] A signal or event was delivered while waiting for all
I/O requests to complete during a LIO_WAIT operation.
Each I/O operation invoked by the lio_listio function
may send a signal when it completes. Therefore, this er-
ror may be caused by the completion of one (or more) of
the very operations being awaited. Outstanding I/O re-
quests are not canceled and the application must examine
each list element to determine whether the request was
initiated, interrupted, or completed.
[EIO] One or more of the individual I/O operations failed. The
application may check error status for each aiocb struc-
ture to determine the individual requests that failed.
[EINVAL] The mode argument is not a proper value.
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 be-
ing 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 addi-
tional errors may occur:
[EGAIN] The requested I/O operation was not queued due to re-
source limitations.
[ECANCELED] The requested I/O operation was cancelled by aio_can-
cel.
[EINPROGRESS] The requested I/O is in progress.
RELATED INFORMATION
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
lio_listio(3)