1AIO_FSYNC(3P)              POSIX Programmer's Manual             AIO_FSYNC(3P)
2
3
4

PROLOG

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

NAME

12       aio_fsync — asynchronous file synchronization
13

SYNOPSIS

15       #include <aio.h>
16
17       int aio_fsync(int op, struct aiocb *aiocbp);
18

DESCRIPTION

20       The aio_fsync() function shall asynchronously perform a  file  synchro‐
21       nization operation, as specified by the op argument, for 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().  The function call shall
25       return when the synchronization request has been initiated or queued to
26       the file or device (even when the data cannot be  synchronized  immedi‐
27       ately).
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.
32
33       If op is O_SYNC, all currently queued I/O operations shall be completed
34       as if by a call to fsync(); that is, as defined  for  synchronized  I/O
35       file  integrity  completion.   If the aio_fsync() function fails, or if
36       the operation queued by aio_fsync() fails, then outstanding I/O  opera‐
37       tions are not guaranteed to have been completed.
38
39       If aio_fsync() succeeds, then it is only the I/O that was queued at the
40       time of the call to aio_fsync() that is guaranteed to be forced to  the
41       relevant completion state. The completion of subsequent I/O on the file
42       descriptor is not guaranteed to be completed in a synchronized fashion.
43
44       The aiocbp argument refers to an asynchronous I/O  control  block.  The
45       aiocbp value may be used as an argument to aio_error() and aio_return()
46       in order to determine the error status and return status, respectively,
47       of  the asynchronous operation while it is proceeding. When the request
48       is queued, the error status for the operation is  [EINPROGRESS].   When
49       all  data  has been successfully transferred, the error status shall be
50       reset to reflect the success or failure of the operation. If the opera‐
51       tion does not complete successfully, the error status for the operation
52       shall be set to indicate the error. The aio_sigevent member  determines
53       the  asynchronous  notification to occur as specified in Section 2.4.1,
54       Signal Generation and Delivery when all operations have  achieved  syn‐
55       chronized I/O completion. All other members of the structure referenced
56       by aiocbp are ignored.  If  the  control  block  referenced  by  aiocbp
57       becomes  an  illegal address prior to asynchronous I/O completion, then
58       the behavior is undefined.
59
60       If the aio_fsync() function fails or aiocbp indicates an  error  condi‐
61       tion, data is not guaranteed to have been successfully transferred.
62

RETURN VALUE

64       The  aio_fsync() function shall return the value 0 if the I/O operation
65       is successfully queued; otherwise, the function shall return the  value
66       -1 and set errno to indicate the error.
67

ERRORS

69       The aio_fsync() function shall fail if:
70
71       EAGAIN The  requested asynchronous operation was not queued due to tem‐
72              porary resource limitations.
73
74       EBADF  The aio_fildes member of the aiocb structure referenced  by  the
75              aiocbp argument is not a valid file descriptor.
76
77       EINVAL This  implementation  does not support synchronized I/O for this
78              file.
79
80       EINVAL The aio_fildes member of the aiocb structure refers to a file on
81              which an fsync() operation is not possible.
82
83       EINVAL A  value  of  op  other than O_DSYNC or O_SYNC was specified, or
84              O_DSYNC was specified and the implementation  does  not  provide
85              runtime support for the Synchronized Input and Output option, or
86              O_SYNC was specified and the  implementation  does  not  provide
87              runtime support for the File Synchronization option.
88
89       In  the  event  that any of the queued I/O operations fail, aio_fsync()
90       shall return the error condition defined for read() and  write().   The
91       error  is  returned in the error status for the asynchronous operation,
92       which can be retrieved using aio_error().
93
94       The following sections are informative.
95

EXAMPLES

97       None.
98

APPLICATION USAGE

100       Note that even if the file descriptor is not open for writing, if there
101       are  any  pending  write requests on the underlying file, then that I/O
102       will be completed prior to the return  of  a  call  to  aio_error()  or
103       aio_return() indicating that the operation has completed.
104

RATIONALE

106       None.
107

FUTURE DIRECTIONS

109       None.
110

SEE ALSO

112       aio_error(),   aio_return(),  fcntl(),  fdatasync(),  fsync(),  open(),
113       read(), write()
114
115       The Base Definitions volume of POSIX.1‐2017, <aio.h>
116
118       Portions of this text are reprinted and reproduced in  electronic  form
119       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
120       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
121       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
122       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
123       event of any discrepancy between this version and the original IEEE and
124       The Open Group Standard, the original IEEE and The Open Group  Standard
125       is  the  referee document. The original Standard can be obtained online
126       at http://www.opengroup.org/unix/online.html .
127
128       Any typographical or formatting errors that appear  in  this  page  are
129       most likely to have been introduced during the conversion of the source
130       files to man page format. To report such errors,  see  https://www.ker
131       nel.org/doc/man-pages/reporting_bugs.html .
132
133
134
135IEEE/The Open Group                  2017                        AIO_FSYNC(3P)
Impressum