Linux and UNIX Man Pages

Test Your Knowledge in Computers #894
Difficulty: Medium
A tr command is also part of ASCII's MSX-DOS2 Tools for MSX-DOS version 2.
True or False?
Linux & Unix Commands - Search Man Pages

lio_listio(2) [freebsd man page]

LIO_LISTIO(2)						      BSD System Calls Manual						     LIO_LISTIO(2)

NAME
lio_listio -- list directed I/O (REALTIME) LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <aio.h> int lio_listio(int mode, struct aiocb * const list[], int nent, struct sigevent *sig); DESCRIPTION
The lio_listio() function initiates a list of I/O requests with a single function call. The list argument is an array of pointers to aiocb structures describing each operation to perform, with nent elements. NULL elements are ignored. The aio_lio_opcode field of each aiocb specifies the operation to be performed. The following operations are supported: LIO_READ Read data as if by a call to aio_read(2). LIO_NOP No operation. LIO_WRITE Write data as if by a call to aio_write(2). If the mode argument is LIO_WAIT, lio_listio() does not return until all the requested operations have been completed. If mode is LIO_NOWAIT, the requests are processed asynchronously, and the signal specified by sig is sent when all operations have completed. If sig is NULL, the calling process is not notified of I/O completion. The order in which the requests are carried out is not specified; in particular, there is no guarantee that they will be executed in the order 0, 1, ..., nent-1. RETURN VALUES
If mode is LIO_WAIT, the lio_listio() function returns 0 if the operations completed successfully, otherwise -1. If mode is LIO_NOWAIT, the lio_listio() function returns 0 if the operations are successfully queued, otherwise -1. ERRORS
The lio_listio() function will fail if: [EAGAIN] There are not enough resources to enqueue the requests. [EAGAIN] The request would cause the system-wide limit AIO_MAX to be exceeded. [EINVAL] The mode argument is neither LIO_WAIT nor LIO_NOWAIT, or nent is greater than AIO_LISTIO_MAX. [EINTR] A signal interrupted the system call before it could be completed. [EIO] One or more requests failed. In addition, the lio_listio() function may fail for any of the reasons listed for aio_read(2) and aio_write(2). If lio_listio() succeeds, or fails with an error code of EAGAIN, EINTR, or EIO, some of the requests may have been initiated. The caller should check the error status of each aiocb structure individually by calling aio_error(2). SEE ALSO
aio_error(2), aio_read(2), aio_write(2), read(2), write(2), siginfo(3), aio(4) STANDARDS
The lio_listio() function is expected to conform to IEEE Std 1003.1-2001 (``POSIX.1''). BSD
January 12, 2003 BSD

Check Out this Related Man Page

lio_listio(3)						     Library Functions Manual						     lio_listio(3)

NAME
lio_listio - Initiates a list of asynchronous I/O requests LIBRARY
Asynchronous I/O Library (libaio, libaio_raw) SYNOPSIS
#include <aio.h> int lio_listio ( int mode, struct aiocb *list[], int nent, struct sigevent *sig ); PARAMETERS
mode Determines whether the lio_listio function 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 Specifies a pointer to an array of pointers to aiocb structures. The array contains nent elements. nent Specifies 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 Specifies 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 deter- mines 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 opera- tion 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 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 0 (zero), the signal is generated. RETURN VALUES
If the mode argument has the value LIO_NOWAIT, the lio_listio function returns the value 0 (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 0 (zero) when all the indicated I/O operations com- plete 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 the 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. 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 requests 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 opera- tion invoked by the lio_listio function may send a signal when it completes. Therefore, this error may be caused by the com- pletion 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. 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 func- tion 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: [EGAIN] The requested I/O operation was not queued due to resource limitations. [ECANCELED] The requested I/O operation was canceled by aio_cancel. [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) Guide to Realtime Programming delim off lio_listio(3)

Featured Tech Videos