2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\" This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH AIO_FSYNC 3C "Feb 5, 2008"
14 aio_fsync \- asynchronous file synchronization
20 \fBint\fR \fBaio_fsync\fR(\fBint\fR \fIop\fR, \fBstruct aiocb *\fR\fIaiocbp\fR);
26 The \fBaio_fsync()\fR function asynchronously forces all I/O operations
27 associated with the file indicated by the file descriptor \fBaio_fildes\fR
28 member of the \fBaiocb\fR structure referenced by the \fIaiocbp\fR argument and
29 queued at the time of the call to \fBaio_fsync()\fR to the synchronized I/O
30 completion state. The function call returns when the synchronization request
31 has been initiated or queued to the file or device (even when the data cannot
32 be synchronized immediately).
35 If \fIop\fR is \fBO_DSYNC\fR, all currently queued I/O operations are completed
36 as if by a call to \fBfdatasync\fR(3C); that is, as defined for synchronized
37 I/O data integrity completion. If \fIop\fR is \fBO_SYNC\fR, all currently
38 queued I/O operations are completed as if by a call to \fBfsync\fR(3C); that
39 is, as defined for synchronized I/O file integrity completion. If the
40 \fBaio_fsync()\fR function fails, or if the operation queued by
41 \fBaio_fsync()\fR fails, then, as for \fBfsync\fR(3C) and \fBfdatasync\fR(3C),
42 outstanding I/O operations are not guaranteed to have been completed.
45 If \fBaio_fsync()\fR succeeds, then it is only the I/O that was queued at the
46 time of the call to \fBaio_fsync()\fR that is guaranteed to be forced to the
47 relevant completion state. The completion of subsequent I/O on the file
48 descriptor is not guaranteed to be completed in a synchronized fashion.
51 The \fIaiocbp\fR argument refers to an asynchronous I/O control block. The
52 \fIaiocbp\fR value may be used as an argument to \fBaio_error\fR(3C) and
53 \fBaio_return\fR(3C) in order to determine the error status and return status,
54 respectively, of the asynchronous operation while it is proceeding. When the
55 request is queued, the error status for the operation is \fBEINPROGRESS.\fR
56 When all data has been successfully transferred, the error status will be reset
57 to reflect the success or failure of the operation. If the operation does not
58 complete successfully, the error status for the operation will be set to
59 indicate the error. The \fIaio_sigevent\fR member determines the asynchronous
60 notification to occur when all operations have achieved synchronized I/O
61 completion (see \fBsignal.h\fR(3HEAD)). All other members of the structure
62 referenced by \fIaiocbp\fR are ignored. If the control block referenced by
63 \fIaiocbp\fR becomes an illegal address prior to asynchronous I/O completion,
64 then the behavior is undefined.
67 If the \fBaio_fsync()\fR function fails or the \fIaiocbp\fR indicates an error
68 condition, data is not guaranteed to have been successfully transferred.
71 If \fIaiocbp\fR is \fINULL\fR, then no status is returned in \fIaiocbp\fR, and
72 no signal is generated upon completion of the operation.
76 The \fBaio_fsync()\fR function returns \fB0\fR to the calling process if the
77 I/O operation is successfully queued; otherwise, the function returns
78 \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
82 The \fBaio_fsync()\fR function will fail if:
89 The requested asynchronous operation was not queued due to temporary resource
99 The \fBaio_fildes\fR member of the \fBaiocb\fR structure referenced by the
100 \fIaiocbp\fR argument is not a valid file descriptor open for writing.
109 The system does not support synchronized I/O for this file.
118 A value of \fIop\fR other than \fBO_DSYNC\fR or \fBO_SYNC\fR was specified.
123 In the event that any of the queued I/O operations fail, \fBaio_fsync()\fR
124 returns the error condition defined for \fBread\fR(2) and \fBwrite\fR(2). The
125 error will be returned in the error status for the asynchronous \fBfsync\fR(3C)
126 operation, which can be retrieved using \fBaio_error\fR(3C).
130 The \fBaio_fsync()\fR function has a transitional interface for 64-bit file
131 offsets. See \fBlf64\fR(5).
135 See \fBattributes\fR(5) for descriptions of the following attributes:
143 ATTRIBUTE TYPE ATTRIBUTE VALUE
145 Interface Stability Committed
149 Standard See \fBstandards\fR(5).
155 \fBfcntl\fR(2), \fBopen\fR(2), \fBread\fR(2), \fBwrite\fR(2),
156 \fBaio_error\fR(3C), \fBaio_return\fR(3C), \fBaio.h\fR(3HEAD),
157 \fBfcntl.h\fR(3HEAD), \fBfdatasync\fR(3C), \fBfsync\fR(3C),
158 \fBsignal.h\fR(3HEAD), \fBattributes\fR(5), \fBlf64\fR(5), \fBstandards\fR(5)