The
aio_fsync() 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_fsync() system call is made, or asynchronously, at any time thereafter. If they are detected at call time,
aio_fsync() 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 is invalid for writing.
[EINVAL]
This implementation does not support synchronized I/O for this file, or the op argument is neither set to O_DSYNC nor O_SYNC.