System Interface Guide

POSIX Asynchronous I/O

POSIX asynchronous I/O is performed using aiocb structures. An aiocb control block identifies each asynchronous I/O request and contains all of the controlling information. A control block can be used for only one request at a time and can be reused after its request has been completed.

A typical POSIX asynchronous I/O operation is initiated by a call to aio_read(3R) or aio_write(3R). Either polling or signals can be used to determine the completion of an operation. If signals are used for operation completion, each operation can be uuniquely tagged and the tag is returned in the si_value component of the generated signal (see siginfo(5)).

aio_read(3R)

aio_read(3R) is called with an asynchronous I/O control block to initiate a read operation.

aio_write(3R)

aio_write(3R) is called with an asynchronous I/O control block to initiate a write operation.

aio_return(3R) and aio_error(3R)

aio_return(3R) and aio_error(3R) are called to obtain return and error values. respectively, after an operation is known to have been completed.

aio_cancel(3R)

aio_cancel(3R) is called with an asynchronous I/O control block to cancel pending operations. It can be used to cancel a specific request, if the control block specifies one, or all of the requests pending for the specified file descriptor.

aio_fsync(3R)

aio_fsync(3R) queues an asynchronousfsync(3C) or fdatasync(3R) request for all of the pending I/O operations on the specified file.

aio_suspend(3R)

aio_suspend(3R) suspends the caller as though one, or more, of the preceding asynchronous I/O requests had been made synchronously.