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 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
32 .\" all rights reserved.
33 .\" Translated Sat Feb 22 20:10:07 JST 1997
34 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
35 .\" Modified Mon May 5 19:46:46 JST 1997
36 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
37 .\" Updated & Modified Wed May 19 03:24:56 JST 2004
38 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
41 .\"WORD: synchronize Ʊ´ü¤µ¤»¤ë
42 .\"WORD: buffer ¥Ð¥Ã¥Õ¥¡¡¼
43 .\"WORD: flush ¥Õ¥é¥Ã¥·¥å
44 .\"WORD: access time ¥¢¥¯¥»¥¹»þ¹ï
45 .\"WORD: database ¥Ç¡¼¥¿¥Ù¡¼¥¹
46 .\"WORD: modification time ½¤Àµ»þ¹ï
48 .\"WORD: descriptor ¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼
50 .TH FDATASYNC 2 2007-07-26 "Linux" "Linux Programmer's Manual"
53 .\"O fdatasync \- synchronize a file's in-core data with that on disk
54 fdatasync \- ¥Õ¥¡¥¤¥ë¤Î¥á¥â¥ê¾å¤Î¥Ç¡¼¥¿¤ò¥Ç¥£¥¹¥¯¾å¤Î¤â¤Î¤ÈƱ´ü¤µ¤»¤ë
57 .B #include <unistd.h>
59 .BI "int fdatasync(int " fd );
62 .\"O Feature Test Macro Requirements for glibc (see
63 .\"O .BR feature_test_macros (7)):
64 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
65 .RB ( feature_test_macros (7)
70 _POSIX_C_SOURCE\ >=\ 199309L || _XOPEN_SOURCE\ >=\ 500
74 .\"O flushes all data buffers of a file to disk (before the system
78 .\"O but is not required to update metadata such as the file last access time.
80 ¤Ï (¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤«¤éÌá¤ëÁ°¤Ë) ¥Õ¥¡¥¤¥ë¤ÎÁ´¤Æ¤Î¥Ç¡¼¥¿¡¦¥Ð¥Ã¥Õ¥¡¡¼¤ò
81 ¥Ç¥£¥¹¥¯¤Ë¥Õ¥é¥Ã¥·¥å (flush) ¤¹¤ë¡£¤³¤ì¤Ï
83 ¤Ë»÷¤Æ¤¤¤ë¤¬¡¢¥Õ¥¡¥¤¥ë¤ÎºÇ½ª¥¢¥¯¥»¥¹»þ¹ï¤È¤¤¤Ã¤¿¥á¥¿¥Ç¡¼¥¿¤ò¹¹¿·¤·¤Ê¤¤¡£
85 .\"O Applications that access databases or log files often write a tiny
86 .\"O data fragment (e.g., one line in a log file) and then call
88 .\"O immediately in order to ensure that the written data is physically
89 .\"O stored on the harddisk.
92 .\"O will always initiate two write operations: one for the newly written
93 .\"O data and another one in order to update the modification time stored
95 .\"O If the modification time is not a part of the transaction
98 .\"O can be used to avoid unnecessary inode disk write operations.
99 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¥¢¥¯¥»¥¹¤·¤¿¤ê¡¢¥í¥°¡¦¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤à¤è¤¦¤Ê
100 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¤·¤Ð¤·¤Ð¾®¤µ¤Ê¥Ç¡¼¥¿¤ÎÃÇÊÒ (Î㤨¤Ð¥í¥°¡¦¥Õ¥¡¥¤¥ë¤Î°ì¹Ô)
101 ¤ò½ñ¤¹þ¤ß¡¢¤½¤ì¤¬¥Ï¡¼¥É¥Ç¥£¥¹¥¯¤ËʪÍýŪ¤Ë³ÊǼ¤µ¤ì¤ë¤³¤È¤òÊݾڤ¹¤ë
104 ¤ò¸Æ¤Ó½Ð¤¹¡£ÉÔ¹¬¤Ê¤³¤È¤Ë¡¢
106 ¤Ï¾ï¤ËÆó²ó¤Î½ñ¤¹þ¤ßÁàºî¤ò¹Ô¤Ê¤¦: °ì¤Ä¤Ï¿·¤·¤¯½ñ¤¹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤ò¡¢
107 ¤â¤¦°ì¤Ä¤Ï inode ¤Î½¤Àµ»þ¹ï¤ò¹¹¿·¤¹¤ë¤¿¤á¤Ë¡£½¤Àµ»þ¹ï¤¬¥È¥é¥¶¥ó¥¯¥·¥ç¥ó
110 ¤ò»ÈÍѤ¹¤ë¤³¤È¤ÇÉÔɬÍפʥǥ£¥¹¥¯¤Ø¤Î inode ¤Î½ñ¤¹þ¤ß½èÍý¤ò
112 .\"O .SH "RETURN VALUE"
114 .\"O On success, zero is returned.
115 .\"O On error, \-1 is returned, and
117 .\"O is set appropriately.
118 À®¸ù¤·¤¿¾ì¹ç¤Ï 0 ¤¬ÊÖ¤µ¤ì¤ë¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
120 ¤ËŬÀÚ¤ÊÃͤ¬ÀßÄꤵ¤ì¤ë¡£
126 .\"O is not a valid file descriptor open for writing.
128 ¤¬½ñ¤¹þ¤ß¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤¿Í¸ú¤Ê¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤Ç¤Ï¤Ê¤¤¡£
131 .\"O An error occurred during synchronization.
132 Ʊ´üÁàºî¤Î´Ö¤Ë¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¡£
134 .BR EROFS ", " EINVAL
136 .\"O is bound to a special file which does not support synchronization.
138 ¤¬Æ±´üÁàºî¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤Æüì¤Ê¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤ë¡£
139 .\"O .SH "CONFORMING TO"
142 .\"O .SH AVAILABILITY
144 .\"O On POSIX systems on which
145 .\"O .BR fdatasync ()
147 .\"O .B _POSIX_SYNCHRONIZED_IO
150 .\"O to a value greater than 0.
152 .\"O .BR sysconf (3).)
154 ¤¬ÍøÍѲÄǽ¤Ê POSIX ¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
157 .B _POSIX_SYNCHRONIZED_IO
158 ¤¬ 0 ¤è¤êÂ礤¤ÃͤËÄêµÁ¤µ¤ì¤Æ¤¤¤ë
161 .\"O .\" POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
162 .\"O .\" -1: unavailable, 0: ask using sysconf().
163 .\"O .\" glibc defines them to 1.
164 .\" POSIX.1-2001 ¤Ç¤Ï¡¢¤³¤ÎÃͤò -1, 0, 200112L ¤Î
165 .\" ¤É¤ì¤«¤ËÄêµÁ¤¹¤Ù¤¤È¤·¤Æ¤¤¤ë¡£
166 .\" -1 ¤Ï»ÈÍÑÉԲġ¢0 ¤Ï sysconf() ¤ò»È¤Ã¤Æ¿Ò¤Í¤ë¤È¤¤¤¦°ÕÌ£¤Ç¤¢¤ë¡£
167 .\" glibc ¤Ç¤Ï¡¢¤³¤ÎÃͤò 1 ¤È¤·¤Æ¤¤¤ë¡£
170 .\"O In Linux 2.2 and earlier,
171 .\"O .BR fdatasync ()
172 .\"O is equivalent to
174 .\"O and so has no performance advantage.
179 ¤ÈÅù²Á¤Ç¤¢¤ê¡¢¤·¤¿¤¬¤Ã¤ÆÀǽ¾å¤ÎÍøÅÀ¤â¤Ê¤¤¡£
183 .BR sync_file_range (2)
185 B.O. Gallmeister, POSIX.4, O'Reilly, pp. 220-223 and 343.