Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lio_listio(3) — Digital UNIX 3.2c

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close(2)

exec(2)

_exit(2)

fork(2)

lseek(2)

read(2)

write(2)

aio_cancel(3)

aio_error(3)

aio_read(3)

aio_return(3)

aio_write(3)

lio_listio(3)  —  Subroutines

NAME

lio_listio − Initiate a list of asynchronous I/O requests (P1003.1b)

SYNOPSIS

#include <aio.h>

int lio_listio (
int mode,
struct aiocb ∗list[],
int nent,
struct sigevent ∗sig);

PARAMETERS

mode Determines whether the lio_listio returns when the I/O operations are completed or as soon as the operations are queued. The mode argument can have a value of either LIO_WAIT or LIO_NOWAIT. 

∗list A pointer to an array of pointers to aiocb structures. The array contains nent elements. 

nent 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. 

∗sig A pointer to a sigevent structure. 

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 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 aiocbp field contains the address of the aiocb structure for that operation.  If the lio_opcode is LIO_READ, the I/O operation is submitted as an aio_read operation.  If the lio_opcode is LIO_WRITE the I/O operation is submitted as an aio_write operation. If the lio_opcode is LIO_NOP, the list entry is skipped. 

The aio_fildes member 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 sigevent.signo is 0, no signal is generated.  If you specify LIO_NOWAIT, and the sig argument is a valid signal, the signal is generated. 

RETURN VALUES

On a successful call, a value of 0 is returned, indicating that the function is successfully queued. 

On an unsuccessful call, a value of −1 is returned and errno is set to indicate that an error occurred. 

If an error occurs, the only way to determine which operations were initiated is to check the aiocb by using the aio_error function. 

If the mode argument has the value of LIO_NOWAIT, the return status indicates whether all of the I/O operations were successfully initiated. If the mode argument has the value of LIO_WAIT, the return status indicates whether the I/O operations were successfully completed. 

In either case, the return value indicates 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 operation. 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. 

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 request(s) that failed.  Nent was greater than AIO_LISTIO_MAX.  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 error may be caused by the completion of one (or more) of the very operations being awaited. Outstanding I/O requests 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 structure to determine the individual requests that failed. 

[EINVAL] The mode argument is not a proper value. 

RELATED INFORMATION

Functions: close(2), exec(2), _exit(2), fork(2), lseek(2), read(2), write(2), aio_cancel(3), aio_error(3), aio_read(3), aio_return(3), aio_write(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026