1 .\" Copyright (c) 1983, 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" Parts of this documentation were written by
7 .\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
8 .\" from the FreeBSD Foundation.
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
18 .\" 3. Neither the name of the University nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
22 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" @(#)fsync.2 8.1 (Berkeley) 6/4/93
42 .Nd "synchronise changes to a file"
48 .Fn fdatasync "int fd"
55 causes all modified data and attributes of the file referenced by
58 to be moved to a permanent storage device.
59 This normally results in all in-core modified copies
60 of buffers for the associated file to be written to a disk.
64 system call causes all modified data of
66 to be moved to a permanent storage device.
69 the system call does not guarantee that file attributes or
70 metadata necessary to access the file are committed to the permanent storage.
75 should be used by programs that require a file to be
76 in a known state, for example, in building a simple transaction
78 If the file metadata has already been committed, using
80 can be more efficient than
87 calls are cancellation points.
101 is not a valid descriptor.
106 refers to a socket, not to a file.
108 An I/O error occurred while reading from or writing to the file system.
117 system call appeared in
121 system call appeared in
126 system call currently does not guarantee that enqueued
128 requests for the file referenced by
130 are completed before the syscall returns.