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
11
13 aio_fsync — asynchronous file synchronization
14
16 #include <aio.h>
17
18 int aio_fsync(int op, struct aiocb *aiocbp);
19
21 The aio_fsync() function shall asynchronously perform a file synchro‐
22 nization operation, as specified by the op argument, for I/O operations
23 associated with the file indicated by the file descriptor aio_fildes
24 member of the aiocb structure referenced by the aiocbp argument and
25 queued at the time of the call to aio_fsync(). The function call shall
26 return when the synchronization request has been initiated or queued to
27 the file or device (even when the data cannot be synchronized immedi‐
28 ately).
29
30 If op is O_DSYNC, all currently queued I/O operations shall be com‐
31 pleted as if by a call to fdatasync(); that is, as defined for synchro‐
32 nized I/O data integrity completion.
33
34 If op is O_SYNC, all currently queued I/O operations shall be completed
35 as if by a call to fsync(); that is, as defined for synchronized I/O
36 file integrity completion. If the aio_fsync() function fails, or if
37 the operation queued by aio_fsync() fails, then outstanding I/O opera‐
38 tions are not guaranteed to have been completed.
39
40 If aio_fsync() succeeds, then it is only the I/O that was queued at the
41 time of the call to aio_fsync() that is guaranteed to be forced to the
42 relevant completion state. The completion of subsequent I/O on the file
43 descriptor is not guaranteed to be completed in a synchronized fashion.
44
45 The aiocbp argument refers to an asynchronous I/O control block. The
46 aiocbp value may be used as an argument to aio_error() and aio_return()
47 in order to determine the error status and return status, respectively,
48 of the asynchronous operation while it is proceeding. When the request
49 is queued, the error status for the operation is [EINPROGRESS]. When
50 all data has been successfully transferred, the error status shall be
51 reset to reflect the success or failure of the operation. If the opera‐
52 tion does not complete successfully, the error status for the operation
53 shall be set to indicate the error. The aio_sigevent member determines
54 the asynchronous notification to occur as specified in Section 2.4.1,
55 Signal Generation and Delivery when all operations have achieved syn‐
56 chronized I/O completion. All other members of the structure referenced
57 by aiocbp are ignored. If the control block referenced by aiocbp
58 becomes an illegal address prior to asynchronous I/O completion, then
59 the behavior is undefined.
60
61 If the aio_fsync() function fails or aiocbp indicates an error condi‐
62 tion, data is not guaranteed to have been successfully transferred.
63
65 The aio_fsync() function shall return the value 0 if the I/O operation
66 is successfully queued; otherwise, the function shall return the value
67 −1 and set errno to indicate the error.
68
70 The aio_fsync() function shall fail if:
71
72 EAGAIN The requested asynchronous operation was not queued due to tem‐
73 porary resource limitations.
74
75 EBADF The aio_fildes member of the aiocb structure referenced by the
76 aiocbp argument is not a valid file descriptor open for writing.
77
78 EINVAL This implementation does not support synchronized I/O for this
79 file.
80
81 EINVAL The aio_fildes member of the aiocb structure refers to a file on
82 which an fsync() operation is not possible.
83
84 EINVAL A value of op other than O_DSYNC or O_SYNC was specified, or
85 O_DSYNC was specified and the implementation does not provide
86 runtime support for the Synchronized Input and Output option, or
87 O_SYNC was specified and the implementation does not provide
88 runtime support for the File Synchronization option.
89
90 In the event that any of the queued I/O operations fail, aio_fsync()
91 shall return the error condition defined for read() and write(). The
92 error is returned in the error status for the asynchronous operation,
93 which can be retrieved using aio_error().
94
95 The following sections are informative.
96
98 None.
99
101 None.
102
104 None.
105
107 None.
108
110 fcntl(), fdatasync(), fsync(), open(), read(), write()
111
112 The Base Definitions volume of POSIX.1‐2008, <aio.h>
113
115 Portions of this text are reprinted and reproduced in electronic form
116 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
117 -- Portable Operating System Interface (POSIX), The Open Group Base
118 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
119 cal and Electronics Engineers, Inc and The Open Group. (This is
120 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
121 event of any discrepancy between this version and the original IEEE and
122 The Open Group Standard, the original IEEE and The Open Group Standard
123 is the referee document. The original Standard can be obtained online
124 at http://www.unix.org/online.html .
125
126 Any typographical or formatting errors that appear in this page are
127 most likely to have been introduced during the conversion of the source
128 files to man page format. To report such errors, see https://www.ker‐
129 nel.org/doc/man-pages/reporting_bugs.html .
130
131
132
133IEEE/The Open Group 2013 AIO_FSYNC(3P)