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