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. A control block can be reused after
its request has been completed.
A typical POSIX asynchronous I/O operation is initiated by a call to
aio_read
()
or aio_write
(). Either polling or
signals can be used to determine the completion of an operation. If signals are used
for completing operations, each operation can be uniquely tagged. The tag is then
returned in the si_value
component of the generated signal. For
more information, see the
siginfo
(3HEAD) man page.
-
aio_read
() -
Is called with an asynchronous I/O control block to initiate a read operation.
-
aio_write
() -
Is called with an asynchronous I/O control block to initiate a write operation.
-
aio_return
(),aio_error
() -
Are called to obtain return and error values, respectively, after an operation is known to have completed.
-
aio_cancel
() -
Is called with an asynchronous I/O control block to cancel pending operations.
aio_cancel
() can be used to cancel a specific request, if a request is specified by the control block.aio_cancel
() can also cancel all of the requests that are pending for the specified file descriptor. -
aio_fsync
() -
Queues an asynchronous
fsync
() orfdatasync
() request for all of the pending I/O operations on the specified file. -
aio_suspend
() -
Suspends the caller as though one or more of the preceding asynchronous I/O requests had been made synchronously.