1AIO_FSYNC(3P) POSIX Programmer's Manual AIO_FSYNC(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 aio_fsync - asynchronous file synchronization (REALTIME)
13
15 #include <aio.h>
16
17 int aio_fsync(int op, struct aiocb *aiocbp);
18
19
21 The aio_fsync() function shall asynchronously force all I/O operations
22 associated with the file indicated by the file descriptor aio_fildes
23 member of the aiocb structure referenced by the aiocbp argument and
24 queued at the time of the call to aio_fsync() to the synchronized I/O
25 completion state. The function call shall return when the synchroniza‐
26 tion request has been initiated or queued to the file or device (even
27 when the data cannot be synchronized immediately).
28
29 If op is O_DSYNC, all currently queued I/O operations shall be com‐
30 pleted as if by a call to fdatasync(); that is, as defined for synchro‐
31 nized I/O data integrity completion. If op is O_SYNC, all currently
32 queued I/O operations shall be completed as if by a call to fsync();
33 that is, as defined for synchronized I/O file integrity completion. If
34 the aio_fsync() function fails, or if the operation queued by
35 aio_fsync() fails, then, as for fsync() and fdatasync(), outstanding
36 I/O operations are not guaranteed to have been completed.
37
38 If aio_fsync() succeeds, then it is only the I/O that was queued at the
39 time of the call to aio_fsync() that is guaranteed to be forced to the
40 relevant completion state. The completion of subsequent I/O on the file
41 descriptor is not guaranteed to be completed in a synchronized fashion.
42
43 The aiocbp argument refers to an asynchronous I/O control block. The
44 aiocbp value may be used as an argument to aio_error() and aio_return()
45 in order to determine the error status and return status, respectively,
46 of the asynchronous operation while it is proceeding. When the request
47 is queued, the error status for the operation is [EINPROGRESS]. When
48 all data has been successfully transferred, the error status shall be
49 reset to reflect the success or failure of the operation. If the oper‐
50 ation does not complete successfully, the error status for the opera‐
51 tion shall be set to indicate the error. The aio_sigevent member
52 determines the asynchronous notification to occur as specified in Sig‐
53 nal Generation and Delivery when all operations have achieved synchro‐
54 nized I/O completion. All other members of the structure referenced by
55 aiocbp are ignored. If the control block referenced by aiocbp becomes
56 an illegal address prior to asynchronous I/O completion, then the
57 behavior is undefined.
58
59 If the aio_fsync() function fails or aiocbp indicates an error condi‐
60 tion, data is not guaranteed to have been successfully transferred.
61
63 The aio_fsync() function shall return the value 0 to the calling
64 process if the I/O operation is successfully queued; otherwise, the
65 function shall return the value -1 and set errno to indicate the error.
66
68 The aio_fsync() function shall fail if:
69
70 EAGAIN The requested asynchronous operation was not queued due to tem‐
71 porary resource limitations.
72
73 EBADF The aio_fildes member of the aiocb structure referenced by the
74 aiocbp argument is not a valid file descriptor open for writing.
75
76 EINVAL This implementation does not support synchronized I/O for this
77 file.
78
79 EINVAL A value of op other than O_DSYNC or O_SYNC was specified.
80
81
82 In the event that any of the queued I/O operations fail, aio_fsync()
83 shall return the error condition defined for read() and write(). The
84 error is returned in the error status for the asynchronous fsync()
85 operation, which can be retrieved using aio_error().
86
87 The following sections are informative.
88
90 None.
91
93 The aio_fsync() function is part of the Asynchronous Input and Output
94 option and need not be available on all implementations.
95
97 None.
98
100 None.
101
103 fcntl(), fdatasync(), fsync(), open(), read(), write(), the Base Defi‐
104 nitions volume of IEEE Std 1003.1-2001, <aio.h>
105
107 Portions of this text are reprinted and reproduced in electronic form
108 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
109 -- Portable Operating System Interface (POSIX), The Open Group Base
110 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
111 Electrical and Electronics Engineers, Inc and The Open Group. In the
112 event of any discrepancy between this version and the original IEEE and
113 The Open Group Standard, the original IEEE and The Open Group Standard
114 is the referee document. The original Standard can be obtained online
115 at http://www.opengroup.org/unix/online.html .
116
117
118
119IEEE/The Open Group 2003 AIO_FSYNC(3P)