| AIO_FSYNC(2) | System Calls Manual | AIO_FSYNC(2) |
aio_fsync —
asynchronous file synchronization (REALTIME)
Standard C Library (libc, -lc)
#include
<aio.h>
int
aio_fsync(int
op, struct aiocb
*aiocbp);
The
aio_fsync()
function shall asynchronously force all I/O operations associated with the
file indicated by the file descriptor
aiocbp->aio_fildes which are queued at the time of
the call to aio_fsync() to the synchronized I/O
completion state. The function call shall return when the synchronization
request has been initiated or queued to the file or device (even when the
data cannot be synchronized immediately).
If op is O_SYNC, all
currently queued I/O operations shall be completed as if by a call to
fsync(2), meaning that all I/O operations shall be
completed as defined for synchronized I/O file integrity completion.
The aiocbp argument refers to
an asynchronous I/O control block. The aiocbp value
may be used as an argument to
aio_error()
and
aio_return()
in order to determine the error status and return status, respectively, of
the asynchronous operation while it is proceeding.
The aiocbp argument points
to an aiocb structure. If this structure contains
valid signal information when
aio_fsync()
returns successfully, then when the asynchronous I/O operation completes, a
signal shall be delivered to the process as specified by the
aio_sigevent member.
The aio_fsync() function shall return the
value 0 if the I/O operation is successfully queued; otherwise, the function
shall return the value -1 and set errno to indicate
the error.
The aio_fsync() function shall fail
if:
EAGAIN]EBADF]EINVAL]EINVAL]O_SYNC.EINVAL]In the event that any of the queued I/O operations fail,
aio_return() shall return the error condition
encountered. If the requested operation does not fail,
aio_return() shall return the value that would be
returned by the corresponding fsync(2) call.
aio_cancel(2), aio_error(2), aio_read(2), aio_return(2), aio_suspend(2), aio_write(2), fsync(2), aio(4)
The aio_fsync() function conforms to
IEEE Std 1003.1-2001 (“POSIX.1”).
The aio_fsync() function first appeared in
UNIX Mac OS X 10.3.
| November 10, 2025 | macOS 26 |