aio_fsync, aio_fsync64 - asynchronously synchronize a file's in-memory
state with that on the physical medium
int aio_fsync(int op, aiocb_t *aiocbp);
int aio_fsync64(int op, aiocb64_t *aiocbp);
The aio_fsync() function asynchronously moves all modified data of a file
indicated by the file descriptor aio_fildes member of the struct aiocb
referenced by the aiocbp argument. The functions return when the
operation is queued. If op is O_SYNC then all modified data and
attributes are forced to the physical medium. If op is O_DSYNC then only
all modified data is forced to the physical medium.
The iocbp argument refers to an asynchronous I/O control block. The iocbp
value may be used as an argument to aio_error and aio_return. When the
request is queued the error status for the operation shall be
[EINPROGRESS]. When the operation is complete the error status is changed
to reflect the result of the operation.
The aiocb->aio_sigevent defines how the calling process will be notified
upon I/O completion.
If sigev_notify is SIGEV_NONE, then no notification will be posted to the
If sigev_notify is SIGEV_SIGNAL, then the signal specified in sigev_signo
will be sent to the calling process. If SA_SIGINFO is set for the signal
(see sigaction(2)) and the signal is in the range of SIGRTMIN and
SIGRTMAX then the signal will be queued to the process and the value in
sigev_value will be the si_value in the generated signal.
If sigev_notify is SIGEV_CALLBACK then the function sigev_func will be
called with sigev_value as the argument. Only one callback will be called
at a time, however programs should be careful to note that a callback may
be run in parallel with the calling process.
If sigev_notify is SIGEV_THREAD then the function sigev_notify_function
will be called by a new thread (see pthreads(5)) with sigev_value as the
argument. This thread is created when the event arrives with the
attributes specified in sigev_notify_attributes except that it is
automatically detached. The calling process should ensure there are
sufficient resources to create the thread.
All aio_fsync() calls must supply a complete aiocb->aio_sigevent
aio_write(3), lio_listio(3), aio_error(3), aio_return(3), aio_cancel(3),
A value of 0 is returned to the calling process if the operation is
successfully queued; otherwise the function returns -1 and is set to
indicate the error.
[EAGAIN] The operation was not queued due to resource limitations
[EBADF] The aio_fildes was not a valid file descriptor open for
[EINVAL] A value other then O_DSYNC or O_SYNC was specified for op.
PPPPaaaaggggeeee 2222 [ Back ]