1.\" $NetBSD: fdatasync.2,v 1.16 2008/04/30 13:10:51 martin Exp $ 2.\" 3.\" Copyright (c) 1998 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Klaus Klein. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd October 25, 2003 31.Dt FDATASYNC 2 32.Os 33.Sh NAME 34.Nm fdatasync 35.Nd synchronize the data of a file 36.Sh LIBRARY 37.Lb libc 38.Sh SYNOPSIS 39.In unistd.h 40.Ft int 41.Fn fdatasync "int fd" 42.Sh DESCRIPTION 43The 44.Fn fdatasync 45function forces all modified data associated with the file descriptor 46.Fa fd 47to be flushed to stable storage. 48.Pp 49The functionality is as described for 50.Xr fsync 2 , 51with the exception that file status information need not be synchronized, 52which may result in a performance gain, compared to 53.Xr fsync 2 . 54This behaviour is commonly known as 55.Bf -symbolic 56synchronized I/O data integrity completion. 57.Ef 58.Sh RETURN VALUES 59A value of 0 is returned on success. 60Otherwise, a value \-1 is returned and 61.Va errno 62is set to indicate the error. 63.Sh ERRORS 64The 65.Fn fdatasync 66function will fail if: 67.Bl -tag -width Er 68.It Bq Er EBADF 69The 70.Fa fd 71argument is not a valid file descriptor open for writing. 72.It Bq Er EINVAL 73This implementation does not support synchronized I/O for this file. 74.It Bq Er ENOSYS 75The 76.Fn fdatasync 77function is not supported by this implementation. 78.El 79.Pp 80In the event that any of the I/O operations to be performed fail, 81.Fn fdatasync 82returns the error conditions defined for 83.Xr read 2 84and 85.Xr write 2 , 86and outstanding I/O operations are not guaranteed to have been completed. 87.Sh SEE ALSO 88.Xr fsync 2 , 89.Xr open 2 , 90.Xr read 2 , 91.Xr write 2 92.Sh STANDARDS 93The 94.Fn fdatasync 95function conforms to 96.St -p1003.1b-93 . 97