The
aio_write() 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_write() system call is made, or asynchronously, at any time thereafter. If they are detected at call time,
aio_write() 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, or is not opened for writing.
[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.
If the request is successfully enqueued, but subsequently canceled or an error occurs, the value returned by the
aio_return() system call is per the
write(2) system call, and the value returned by the
aio_error() system call is either one of the error returns from the
write(2) system call, or one of:
[EBADF]
The aiocbp->aio_fildes argument is invalid for writing.
[ECANCELED]
The request was explicitly canceled via a call to aio_cancel().
[EINVAL]
The offset aiocbp->aio_offset would be invalid.