NAME
aio_fsync —
asynchronous file synchronization
(REALTIME)
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include
<aio.h>
int
aio_fsync(int
op, struct aiocb
*aiocbp);
DESCRIPTION
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.
RETURN VALUES
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.
ERRORS
The aio_fsync() function shall fail
if:
- [
EAGAIN] - The requested asynchronous I/O operation was not queued due to system resource limitations.
- [
EBADF] - The aio_fildes member of the aiocb structure referenced by the aiocbp argument is not a valid file descriptor.
- [
EINVAL] - This implementation does not support synchronized I/O for this file.
- [
EINVAL] - The op argument is not
O_SYNC. - [
EINVAL] - A value of the aiocbp argument does not refer to an asynchronous I/O control block object for which a synchronization operation is appropriate.
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.
SEE ALSO
aio_cancel(2), aio_error(2), aio_read(2), aio_return(2), aio_suspend(2), aio_write(2), fsync(2), aio(4)
STANDARDS
The aio_fsync() function conforms to
IEEE Std 1003.1-2001 (“POSIX.1”).
HISTORY
The aio_fsync() function first appeared in
Unix Mac OS X 10.3.