1aio_fsync(3C) Standard C Library Functions aio_fsync(3C)
2
3
4
6 aio_fsync - asynchronous file synchronization
7
9 #include <aio.h>
10
11 int aio_fsync(int op, struct aiocb *aiocbp);
12
13
15 The aio_fsync() function asynchronously forces all I/O operations asso‐
16 ciated with the file indicated by the file descriptor aio_fildes member
17 of the aiocb structure referenced by the aiocbp argument and queued at
18 the time of the call to aio_fsync() to the synchronized I/O completion
19 state. The function call returns when the synchronization request has
20 been initiated or queued to the file or device (even when the data can‐
21 not be synchronized immediately).
22
23
24 If op is O_DSYNC, all currently queued I/O operations are completed as
25 if by a call to fdatasync(3C); that is, as defined for synchronized I/O
26 data integrity completion. If op is O_SYNC, all currently queued I/O
27 operations are completed as if by a call to fsync(3C); that is, as
28 defined for synchronized I/O file integrity completion. If the
29 aio_fsync() function fails, or if the operation queued by aio_fsync()
30 fails, then, as for fsync(3C) and fdatasync(3C), outstanding I/O opera‐
31 tions are not guaranteed to have been completed.
32
33
34 If aio_fsync() succeeds, then it is only the I/O that was queued at the
35 time of the call to aio_fsync() that is guaranteed to be forced to the
36 relevant completion state. The completion of subsequent I/O on the file
37 descriptor is not guaranteed to be completed in a synchronized fashion.
38
39
40 The aiocbp argument refers to an asynchronous I/O control block. The
41 aiocbp value may be used as an argument to aio_error(3C) and
42 aio_return(3C) in order to determine the error status and return sta‐
43 tus, respectively, of the asynchronous operation while it is proceed‐
44 ing. When the request is queued, the error status for the operation is
45 EINPROGRESS. When all data has been successfully transferred, the error
46 status will be reset to reflect the success or failure of the opera‐
47 tion. If the operation does not complete successfully, the error status
48 for the operation will be set to indicate the error. The aio_sigevent
49 member determines the asynchronous notification to occur when all oper‐
50 ations have achieved synchronized I/O completion (see signal.h(3HEAD)).
51 All other members of the structure referenced by aiocbp are ignored. If
52 the control block referenced by aiocbp becomes an illegal address prior
53 to asynchronous I/O completion, then the behavior is undefined.
54
55
56 If the aio_fsync() function fails or the aiocbp indicates an error con‐
57 dition, data is not guaranteed to have been successfully transferred.
58
59
60 If aiocbp is NULL, then no status is returned in aiocbp, and no signal
61 is generated upon completion of the operation.
62
64 The aio_fsync() function returns 0 to the calling process if the I/O
65 operation is successfully queued; otherwise, the function returns −1
66 and sets errno to indicate the error.
67
69 The aio_fsync() function will fail if:
70
71 EAGAIN The requested asynchronous operation was not queued due to
72 temporary resource limitations.
73
74
75 EBADF The aio_fildes member of the aiocb structure referenced by
76 the aiocbp argument is not a valid file descriptor open for
77 writing.
78
79
80 EINVAL The system does not support synchronized I/O for this file.
81
82
83 EINVAL A value of op other than O_DSYNC or O_SYNC was specified.
84
85
86
87 In the event that any of the queued I/O operations fail, aio_fsync()
88 returns the error condition defined for read(2) and write(2). The error
89 will be returned in the error status for the asynchronous fsync(3C)
90 operation, which can be retrieved using aio_error(3C).
91
93 The aio_fsync() function has a transitional interface for 64-bit file
94 offsets. See lf64(5).
95
97 See attributes(5) for descriptions of the following attributes:
98
99
100
101
102 ┌─────────────────────────────┬─────────────────────────────┐
103 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
104 ├─────────────────────────────┼─────────────────────────────┤
105 │Interface Stability │Committed │
106 ├─────────────────────────────┼─────────────────────────────┤
107 │MT-Level │MT-Safe │
108 ├─────────────────────────────┼─────────────────────────────┤
109 │Standard │See standards(5). │
110 └─────────────────────────────┴─────────────────────────────┘
111
113 fcntl(2), open(2), read(2), write(2), aio_error(3C), aio_return(3C),
114 aio.h(3HEAD), fcntl.h(3HEAD), fdatasync(3C), fsync(3C), sig‐
115 nal.h(3HEAD), attributes(5), lf64(5), standards(5)
116
117
118
119SunOS 5.11 5 Feb 2008 aio_fsync(3C)