1.\" $NetBSD: aio_fsync.3,v 1.8 2017/07/03 21:32:51 wiz Exp $ 2.\" 3.\" Copyright (c) 2007 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd May 17, 2010 28.Dt AIO_FSYNC 3 29.Os 30.Sh NAME 31.Nm aio_fsync 32.Nd asynchronous data synchronization of file (REALTIME) 33.Sh LIBRARY 34.Lb librt 35.Sh SYNOPSIS 36.In aio.h 37.Ft int 38.Fn aio_fsync "int op" "struct aiocb *aiocbp" 39.Sh DESCRIPTION 40The 41.Fn aio_fsync 42system call allows the calling process to force all modified data 43associated with the file descriptor 44.Fa aiocbp->aio_fildes 45to be flushed to the stable storage device. 46The call returns immediately after the synchronization request has been 47enqueued to the descriptor; the synchronization may or may not have 48completed at the time the call returns. 49If the request could not be enqueued, generally due to invalid arguments, 50the call returns without having enqueued the request. 51.Pp 52The 53.Fa op 54argument could be set only to 55.Dv O_DSYNC 56or 57.Dv O_SYNC . 58If 59.Fa op 60is 61.Dv O_DSYNC , 62then 63.Fn aio_fsync 64does the same as a 65.Fn fdatasync 66call, if 67.Dv O_SYNC , 68then the same as 69.Fn fsync . 70.Pp 71If 72.Dv _POSIX_PRIORITIZED_IO 73is defined, and the descriptor supports it, then the enqueued 74operation is submitted at a priority equal to that of the calling 75process minus 76.Fa aiocbp->aio_reqprio . 77.Pp 78The 79.Fa aiocbp 80pointer may be subsequently used as an argument to 81.Fn aio_return 82and 83.Fn aio_error 84in order to determine return or error status for the enqueued operation 85while it is in progress. 86.Sh RETURN VALUES 87.Rv -std aio_fsync 88.Sh ERRORS 89The 90.Fn aio_fsync 91system call will fail if: 92.Bl -tag -width Er 93.It Bq Er EAGAIN 94The request was not queued because of system resource limitations. 95.El 96.Pp 97The following conditions may be synchronously detected when the 98.Fn aio_fsync 99system call is made, or asynchronously, at any time thereafter. 100If they are detected at call time, 101.Fn aio_fsync 102returns \-1 and sets 103.Va errno 104appropriately; otherwise the 105.Fn aio_return 106system call must be called, and will return \-1, and 107.Fn aio_error 108must be called to determine the actual value that would have been 109returned in 110.Va errno . 111.Bl -tag -width Er 112.It Bq Er EBADF 113The 114.Fa aiocbp->aio_fildes 115is invalid for writing. 116.It Bq Er EINVAL 117This implementation does not support synchronized I/O for this file, 118or the 119.Fa op 120argument is neither set to 121.Dv O_DSYNC 122nor 123.Dv O_SYNC . 124.El 125.Sh SEE ALSO 126.Xr fcntl 2 , 127.Xr fdatasync 2 , 128.Xr fsync 2 , 129.Xr aio 3 130.Sh STANDARDS 131The 132.Fn aio_fsync 133system call is expected to conform to the 134.St -p1003.1-2001 135standard. 136.Sh HISTORY 137The 138.Fn aio_fsync 139system call first appeared in 140.Nx 5.0 . 141