The
aio_read() system call will fail if:
[EAGAIN]
The request was not queued because of system resource limitations.
The following conditions may be synchronously detected when the
aio_read() system call is made, or asynchronously, at any time thereafter. If they are detected at call time,
aio_read() returns -1 and sets
errno appropriately; otherwise the
aio_return() system call must be called, and will return -1, and
aio_error() must be called to determine the actual value that would have been returned in
errno.
[EBADF]
The aiocbp->aio_fildes argument is invalid.
[EINVAL]
The offset aiocbp->aio_offset is not valid, the priority specified by aiocbp->aio_reqprio is not a valid priority, or the number of bytes specified by aiocbp->aio_nbytes is not valid.
[EOVERFLOW]
The file is a regular file, aiocbp->aio_nbytes is greater than zero, the starting offset in aiocbp->aio_offset is before the end of the file, but is at or beyond the aiocbp->aio_fildes offset maximum.
If the request is successfully enqueued, but subsequently cancelled or an error occurs, the value returned by the
aio_return() system call is per the
read(2) system call, and the value returned by the
aio_error() system call is either one of the error returns from the
read(2) system call, or one of:
[EBADF]
The aiocbp->aio_fildes argument is invalid for reading.
[ECANCELED]
The request was explicitly cancelled via a call to aio_cancel().
[EINVAL]
The offset aiocbp->aio_offset would be invalid.