1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
4 .\" Copyright (C) 1996 Markus Kuhn.
6 .\" [This version merged from two independently written pages - aeb]
8 .\" Permission is granted to make and distribute verbatim copies of this
9 .\" manual provided the copyright notice and this permission notice are
10 .\" preserved on all copies.
12 .\" Permission is granted to copy and distribute modified versions of this
13 .\" manual under the conditions for verbatim copying, provided that the
14 .\" entire resulting derived work is distributed under the terms of a
15 .\" permission notice identical to this one.
17 .\" Since the Linux kernel and libraries are constantly changing, this
18 .\" manual page may be incorrect or out-of-date. The author(s) assume no
19 .\" responsibility for errors or omissions, or for damages resulting from
20 .\" the use of the information contained herein. The author(s) may not
21 .\" have taken the same level of care in the production of this manual,
22 .\" which is licensed free of charge, as they might when working
25 .\" Formatted or processed versions of this manual, if unaccompanied by
26 .\" the source, must acknowledge the copyright and authors of this work.
28 .\" 1996-04-12 Andries Brouwer <aeb@cwi.nl>
29 .\" 1996-04-13 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
31 .TH FDATASYNC 2 1996-04-13 "Linux" "Linux Programmer's Manual"
33 fdatasync \- synchronize a file's in-core data with that on disk
35 .B #include <unistd.h>
37 .BI "int fdatasync(int " fd );
40 flushes all data buffers of a file to disk (before the system
44 but is not required to update metadata such as the file last access time.
46 Applications that access databases or log files often write a tiny
47 data fragment (e.g., one line in a log file) and then call
49 immediately in order to ensure that the written data is physically
50 stored on the harddisk.
53 will always initiate two write operations: one for the newly written
54 data and another one in order to update the modification time stored
56 If the modification time is not a part of the transaction
59 can be used to avoid unnecessary inode disk write operations.
61 On success, zero is returned.
62 On error, \-1 is returned, and
69 is not a valid file descriptor open for writing.
72 An error occurred during synchronization.
76 is bound to a special file which does not support synchronization.
80 On POSIX systems on which
83 .B _POSIX_SYNCHRONIZED_IO
86 to a value greater than 0.
89 .\" POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
90 .\" -1: unavailable, 0: ask using sysconf().
91 .\" glibc defines them to 1.
93 In Linux 2.2 and earlier,
97 and so has no performance advantage.
100 .BR sync_file_range (2)
102 B.O. Gallmeister, POSIX.4, O'Reilly, pp. 220-223 and 343.