| 1 |
'\" t |
| 2 |
.\" Copyright 2003, Andries E. Brouwer <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
.\" |
| 7 |
.TH aio_fsync 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
aio_fsync \- asynchronous file synchronization |
| 10 |
.SH LIBRARY |
| 11 |
Real-time library |
| 12 |
.RI ( librt ,\~ \-lrt ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B "#include <aio.h>" |
| 16 |
.P |
| 17 |
.BI "int aio_fsync(int " op ", struct aiocb *" aiocbp ); |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
The |
| 21 |
.BR aio_fsync () |
| 22 |
function does a sync on all outstanding asynchronous I/O operations |
| 23 |
associated with |
| 24 |
.IR aiocbp\->aio_fildes . |
| 25 |
(See |
| 26 |
.BR aio (7) |
| 27 |
for a description of the |
| 28 |
.I aiocb |
| 29 |
structure.) |
| 30 |
.P |
| 31 |
More precisely, if |
| 32 |
.I op |
| 33 |
is |
| 34 |
.BR O_SYNC , |
| 35 |
then all currently queued I/O operations shall be |
| 36 |
completed as if by a call of |
| 37 |
.BR fsync (2), |
| 38 |
and if |
| 39 |
.I op |
| 40 |
is |
| 41 |
.BR O_DSYNC , |
| 42 |
this call is the asynchronous analog of |
| 43 |
.BR fdatasync (2). |
| 44 |
.P |
| 45 |
Note that this is a request only; |
| 46 |
it does not wait for I/O completion. |
| 47 |
.P |
| 48 |
Apart from |
| 49 |
.IR aio_fildes , |
| 50 |
the only field in the structure pointed to by |
| 51 |
.I aiocbp |
| 52 |
that is used by this call is the |
| 53 |
.I aio_sigevent |
| 54 |
field (a |
| 55 |
.I sigevent |
| 56 |
structure, described in |
| 57 |
.BR sigevent (3type)), |
| 58 |
which indicates the desired type of asynchronous notification at completion. |
| 59 |
All other fields are ignored. |
| 60 |
.SH RETURN VALUE |
| 61 |
On success (the sync request was successfully queued) |
| 62 |
this function returns 0. |
| 63 |
On error, \-1 is returned, and |
| 64 |
.I errno |
| 65 |
is set to indicate the error. |
| 66 |
.SH ERRORS |
| 67 |
.TP |
| 68 |
.B EAGAIN |
| 69 |
Out of resources. |
| 70 |
.TP |
| 71 |
.B EBADF |
| 72 |
.I aio_fildes |
| 73 |
is not a valid file descriptor open for writing. |
| 74 |
.TP |
| 75 |
.B EINVAL |
| 76 |
Synchronized I/O is not supported for this file, or |
| 77 |
.I op |
| 78 |
is not |
| 79 |
.B O_SYNC |
| 80 |
or |
| 81 |
.BR O_DSYNC . |
| 82 |
.TP |
| 83 |
.B ENOSYS |
| 84 |
.BR aio_fsync () |
| 85 |
is not implemented. |
| 86 |
.SH ATTRIBUTES |
| 87 |
For an explanation of the terms used in this section, see |
| 88 |
.BR attributes (7). |
| 89 |
.TS |
| 90 |
allbox; |
| 91 |
lbx lb lb |
| 92 |
l l l. |
| 93 |
Interface Attribute Value |
| 94 |
T{ |
| 95 |
.na |
| 96 |
.nh |
| 97 |
.BR aio_fsync () |
| 98 |
T} Thread safety MT-Safe |
| 99 |
.TE |
| 100 |
.SH STANDARDS |
| 101 |
POSIX.1-2008. |
| 102 |
.SH HISTORY |
| 103 |
glibc 2.1. |
| 104 |
POSIX.1-2001. |
| 105 |
.SH SEE ALSO |
| 106 |
.BR aio_cancel (3), |
| 107 |
.BR aio_error (3), |
| 108 |
.BR aio_read (3), |
| 109 |
.BR aio_return (3), |
| 110 |
.BR aio_suspend (3), |
| 111 |
.BR aio_write (3), |
| 112 |
.BR lio_listio (3), |
| 113 |
.BR aio (7), |
| 114 |
.BR sigevent (3type) |