#include <aio.h> int aio_read(struct aiocb *aiocbp); int aio_write(struct aiocb *aiocbp); int aio_error(const struct aiocb *aiocbp); ssize_t aio_return(struct aiocb *aiocbp); int aio_suspend(struct aiocb *list[], int nent, const struct timespec *timeout); int aio_waitn(struct aiocb *list[], uint_t nent, uint_t *nwait, const struct timespec *timeout); int aio_cancel(int fildes, struct aiocb *aiocbp);
aio_read(3RT) and aio_write(3RT) are similar in concept to pread(2) and pwrite(2), except that the parameters of the I/O operation are stored in an asynchronous I/O control block (aiocbp) that is passed to aio_read() or aio_write():
aiocbp->aio_fildes; /* file descriptor */ aiocbp->aio_buf; /* buffer */ aiocbp->aio_nbytes; /* I/O request size */ aiocbp->aio_offset; /* file offset */
In addition, if desired, an asynchronous notification type (most commonly a queued signal) can be specified in the 'struct sigevent' member:
aiocbp->aio_sigevent; /* notification type */
A call to aio_read() or aio_write() results in the initiation or queueing of an I/O operation. The call returns without blocking.
The aiocbp value may be used as an argument to aio_error(3RT) and aio_return(3RT) in order to determine the error status and return status of the asynchronous operation while it is proceeding.