aio_fsync(3P4)
NAME
aio_fsync − asynchronous file synchronization
SYNOPSIS
#include <aio.h>
int aio_fsync(opcode, aiocbp);
int opcode;
struct aiocb ∗aiocbp;
DESCRIPTION
The aio_fsync function asynchronously forces all I/O operations which have been submitted to the file indicated by file descriptor aiocbp->aio_fildes to the synchronized completion state (as defined in open(2)). Only the I/O operations which are submitted prior to the aio_fsync call are guaranteed to be synchronized. aio_fsync returns when the asynchronous request has been queued to the file. If opcode is O_DSYNC, all currently queued I/O operations are completed as if by a call to fdatasync(2). If opcode is O_SYNC, all currently queued I/O operations are completed as if by a call to fsync(2).
The aiocbp argument points to an asynchronous I/O control block. The aiocbp value may be used as an argument to aio_error(3P4) and aio_return(3P4) in order to determine the error status and return status of the asynchronous operation while it is proceeding. When the request is queued, the error status for the operation is [EINPROGRESS]. When all data has been successfully transferred the error status is reset to reflect the success or failure of the operation. If the operation does not complete successfully, the error status for the operation is set to indicate the error.
The aiocbp->aio_sigevent member defines the signal to be delivered upon completion of the I/O generated by the aio_fsync operation. If aiocbp->aio_sigevent.sigev_signo is non-zero, then a signal shall be generated when all operations have achieved synchronized completion. All other members of the structure referenced by aiocbp are ignored.
The afsyncd daemon must be active for this service to run. See afsyncd(1M).
RETURN VALUE
The aio_fsync function returns the value 0 to the calling process if the I/O operation is successfully queued; otherwise, the function returns a -1 and sets errno to indicate the error.
[ENOSYS] The afsyncd daemon that services aio_fsync requests is not active. Start it up and try the request again. Only the superuser can start up the daemon.
[EAGAIN] The requested asynchronous operation was not queued due to temporary resource limitations.
[EBADF] The aiocbp->aio_fildes argument is not a valid file descriptor open for writing.
[EINVAL] This implementation does not support synchronized I/O for the device type associated with this file. A value of opcode other than O_DSYNC or O_SYNC was specified. The aiocbp parameter is a NULL pointer. An asynchronous I/O control block is required to make the request.
[EFAULT] The system is unable to access the aiocb structure that the aiocbp argument points to.
FILES
/usr/lib/libposix4.a
SEE ALSO
aio_read(3P4), aio_write(3P4), aio_error(3P4), aio_return(3P4), aio_cancel(3P4), aio_suspend(3P4), lio_listio(3P4), "CX/UX Programmer’s Guide"
WARNING
The interface to aio_fsync is based on IEEE Draft Standard P1003.4/D12. This is an unapproved draft, subject to change. Use of information contained in this unapproved draft is at your own risk. This interface will change to reflect any changes made by future drafts of POSIX 1003.4.
CX/UX Programmer’s Reference Manual