[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    aio_fsync(3R) manual page Table of Contents

Name

aio_fsync - asynchronous file synchronization

Synopsis

cc [ flag ... ] file ... -lposix4 [ library ... ]

#include <aio.h>

int aio_fsync(int op, aiocb *aiocbp);

MT-Level

MT-Safe

Description

aio_fsync() queues an asynchronous fsync(3C) or fdatasync(3R) request for all the currently queued I/O operations on the file referenced by aiocbp->aio_fildes, and returns control immediately. This request is serviced concurrently with other activity of the process. If op is O_DSYNC, all I/O operations are completed by a call to fdatasync(3R) (synchronized I/O data integrity completion). If op is O_SYNC, all I/O operations are completed by a call to fsync(3C) (synchronized I/O file integrity completion). (see fcntl(5) definitions of O_DSYNC and O_SYNC.)

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. aio_return(3R) and aio_error(3R) may be used with this aiocbp value to monitor both the return and the error status of the asynchronous operation while it is proceeding.

aiocbp->aio_sigevent defines the signal to be generated upon I/O completion.
If aiocbp->aio_sigevent.sigev_signo is non-zero, then a signal will be generated when all I/O operations have achieved syncronized I/O completion.

struct aiocb {
intaio_fildes;/* file descriptor */
volatile void*aio_buf;/* buffer location */
size_taio_nbytes;/* length of transfer */
off_taio_offset;/* file offset */
intaio_reqprio;/* request priority offset */
struct sigeventaio_sigevent;/* signal number and offset */
intaio_lio_opcode;/* listio operation */
};

struct sigevent {
intsigev_notify;/* notification mode */
intsigev_signo;/* signal number */
union sigvalsigev_value;/* signal value */
};

union sigval {
intsival_int;/* integer value */
void*sival_ptr;/* pointer value */
};

Return Values

If the I/O operation is successfully queued, aio_fsync() returns 0. Otherwise, it returns -1, and sets errno to indicate the error condition.

Errors

EAGAIN
The requested asynchronous operation was not queued due to temporary resource limitations.
EBADF
aiocbp->aio_fildes is not a valid file descriptor open for writing.
EINVAL
This implementation does not support synchronized I/O for this file.

A value of op other than O_DSYNC or O_SYNC was specified.

ENOSYS
aio_fsync() is not supported by this implementation.

See Also

fcntl(2) , open(2) , read(2) , write(2) , fsync(3C) , aio_error(3R) , aio_return(3R) , fdatasync(3R) , fcntl(5)

Notes

If aio_fsync() fails, outstanding I/O operations are not guaranteed to have been completed.

Applications compiled under Solaris 2.3 and 2.4 and using POSIX aio must be recompiled to work correctly when Solaris supports the Asynchronous Input and Output option.

Bugs

In Solaris 2.5, these functions always return -1 and set errno to ENOSYS, because this release does not support the Asynchronous Input and Output option. It is our intention to provide support for these interfaces in future releases.


Table of Contents