1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) and
4 .\" and Copyright 2006 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Modified 21 Aug 1994 by Michael Chastain <mec@shell.portal.com>:
27 .\" Removed note about old libc (pre-4.5.26) translating to 'sync'.
28 .\" Modified 15 Apr 1995 by Michael Chastain <mec@shell.portal.com>:
29 .\" Added `see also' section.
30 .\" Modified 13 Apr 1996 by Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
31 .\" Added remarks about fdatasync.
32 .\" Modified Fri Jan 31 16:27:42 1997 by Eric S. Raymond <esr@thyrsus.com>
33 .\" Modified 31 Jan 1997 by Eric S. Raymond <esr@thyrsus.com>
34 .\" Modified 18 Apr 2001 by Andi Kleen
35 .\" Fix description to describe what it really does; add a few caveats.
36 .\" 2006-04-28, mtk, substantial rewrite of various parts.
38 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
39 .\" all rights reserved.
40 .\" Translated 1997-02-22, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
41 .\" Modified 2001-05-19, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
42 .\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
43 .\" Updated 2006-07-30, Kentaro Shirakata <argrath@ub32.org>
44 .\" Updated 2007-10-13, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.65
47 .\"WORD: disk ¥Ç¥£¥¹¥¯
48 .\"WORD: synchronize Ʊ´ü¤µ¤»¤ë
50 .TH FSYNC 2 2008-11-07 "Linux" "Linux Programmer's Manual"
52 fsync \- ¥á¥â¥ê¾å¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤ÎÆâÍƤò¥¹¥È¥ì¡¼¥¸¥Ç¥Ð¥¤¥¹¾å¤Î¤â¤Î¤ÈƱ´ü¤µ¤»¤ë
54 .B #include <unistd.h>
56 .BI "int fsync(int " fd );
58 .BI "int fdatasync(int " fd );
61 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
62 .RB ( feature_test_macros (7)
67 _BSD_SOURCE || _XOPEN_SOURCE
69 || /* glibc 2.8 °Ê¹ß¤Ç¤Ï: */ _POSIX_C_SOURCE\ >=\ 200112L
70 .\" _POSIX_C_SOURCE\ >=\ 200112L ¤Ï glibc 2.8 °Ê¹ß¤Î¤ß
73 _POSIX_C_SOURCE\ >=\ 199309L || _XOPEN_SOURCE\ >=\ 500
78 ¤Ç»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤ÎÆâÉô¤Ç»ý¤Ã¤Æ¤¤¤ë¥Ç¡¼¥¿
79 (¤Ä¤Þ¤ê¥Ð¥Ã¥Õ¥¡¥¥ã¥Ã¥·¥å¥Ú¡¼¥¸) ¤Î¤¦¤Á½¤Àµ¤µ¤ì¤¿¥Ç¡¼¥¿¤ò¡¢
80 ¤½¤Î¥Õ¥¡¥¤¥ë¤¬Â°¤¹¤ë¥Ç¥£¥¹¥¯¥Ç¥Ð¥¤¥¹ (¤Þ¤¿¤Ï¤½¤Î¾¤Î±Ê³¥¹¥È¥ì¡¼¥¸¥Ç¥Ð¥¤¥¹)
81 ¤ËžÁ÷ (¡Ö¥Õ¥é¥Ã¥·¥å¡×) ¤¹¤ë¡£
82 ¤³¤Î¸Æ¤Ó½Ð¤·¤ÏžÁ÷¤¬½ª¤ï¤Ã¤¿¤È¥Ç¥Ð¥¤¥¹¤¬Êó¹ð¤¹¤ë¤Þ¤Ç¥Ö¥í¥Ã¥¯¤¹¤ë¡£
83 ¤Þ¤¿¥Õ¥¡¥¤¥ë¤Ë·ë¤Ó¤Ä¤¤¤¿¥á¥¿¥Ç¡¼¥¿¾ðÊó
85 »²¾È) ¤â¥Õ¥é¥Ã¥·¥å¤¹¤ë¡£
88 ¤Î¸Æ¤Ó½Ð¤·¤Ï¡¢¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Æ¤¤¤ë¥Ç¥£¥ì¥¯¥È¥ê¤Î¥¨¥ó¥È¥ê¤¬¥Ç¥£¥¹¥¯¤Ø
89 ½ñ¤¹þ¤Þ¤ì¤¿¤³¤È¤òÊݾڤ¹¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
90 Êݾڤ¹¤ë¤¿¤á¤Ë¤ÏÌÀ¼¨Åª¤Ë¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¥Õ¥¡¥¤¥ëµ½Ò»Ò¤ËÂФ·¤Æ¤â
97 ¤ÈƱÍͤǤ¢¤ë¤¬¡¢¥á¥¿¥Ç¡¼¥¿¤Î°·¤¤¤¬°Û¤Ê¤ë¡£
99 ¤Ï¡¢¤½¤ì°Ê¹ß¤Î¥Ç¡¼¥¿Æɤ߹þ¤ß¤òÀµ¤·¤¯°·¤¦¤¿¤á¤Ë¤½¤Î¥á¥¿¥Ç¡¼¥¿¤¬É¬ÍפË
100 ¤Ê¤é¤Ê¤¤¸Â¤ê¡¢Êѹ¹¤µ¤ì¤¿¥á¥¿¥Ç¡¼¥¿¤ò¥Õ¥é¥Ã¥·¥å¤·¤Ê¤¤¡£
103 (¤½¤ì¤¾¤ìºÇ½ª¥¢¥¯¥»¥¹»þ¹ï¡¢ºÇ½ª½¤Àµ»þ¹ï;
105 »²¾È) ¤ÎÊѹ¹¤Ï¥Õ¥é¥Ã¥·¥å¤òɬÍפȤ·¤Ê¤¤¡£
106 ¤Ê¤¼¤Ê¤é¤³¤ì¤é¤Ï¤½¤ì°Ê¹ß¤Î¥Ç¡¼¥¿Æɤ߹þ¤ß¤òÀµ¤·¤¯°·¤¦¤¿¤á¤Ë
107 ɬÍפǤϤʤ¤¤«¤é¤Ç¤¢¤ë¡£
112 ¤ÎÊѹ¹¤Ï¥á¥¿¥Ç¡¼¥¿¤Î¥Õ¥é¥Ã¥·¥å¤¬É¬ÍפǤ¢¤ë¡£
114 ¤ÎÁÀ¤¤¤Ï¡¢Á´¤Æ¤Î¥á¥¿¥Ç¡¼¥¿¤ò¥Ç¥£¥¹¥¯¤ÈƱ´ü¤¹¤ëɬÍפΤʤ¤
115 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ËÂФ·¤Æ¡¢¥Ç¥£¥¹¥¯¥¢¥¯¥»¥¹¤ò¸º¤é¤¹¤³¤È¤Ç¤¢¤ë¡£
117 À®¸ù¤·¤¿¾ì¹ç¡¢¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¥¼¥í¤òÊÖ¤¹¡£
118 ¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤¬ÊÖ¤µ¤ì¡¢
125 ¤¬½ñ¤¹þ¤ß¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ëµ½Ò»Ò¤Ç¤Ê¤¤¡£
128 Ʊ´üÁàºî¤Î´Ö¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
130 .BR EROFS ", " EINVAL
132 ¤¬Æ±´üÁàºî¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤Ê¤¤Æüì¤Ê¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤ë¡£
134 4.3BSD, POSIX.1-2001.
137 ¤¬ÍøÍѲÄǽ¤Ê POSIX ¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
138 .B _POSIX_SYNCHRONIZED_IO
141 ¤Ç 0 ¤è¤êÂ礤ÊÃͤËÄêµÁ¤µ¤ì¤ë
144 .\" POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
145 .\" -1: unavailable, 0: ask using sysconf().
146 .\" glibc defines them to 1.
148 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ä¥í¥°¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¡¢
149 Èó¾ï¤Ë¾®¤µ¤Ê¥Ç¡¼¥¿¤ÎÃÇÊҤνñ¤¹þ¤ß¤ò¹Ô¤¤¡¢¤½¤Î¸å¤¹¤°¤Ë
151 ¤ò¸Æ¤Ó½Ð¤·¤Æ¡¢½ñ¤¹þ¤ó¤À¥Ç¡¼¥¿¤¬¥Ï¡¼¥É¥Ç¥£¥¹¥¯¤ËʪÍýŪ¤Ë
152 ³Î¼Â¤Ë³ÊǼ¤µ¤ì¤ë¤è¤¦¤Ë¤¹¤ë¤³¤È¤¬Â¿¤¤¡£
155 ¤Ï¾ï¤Ë 2¤Ä¤Î½ñ¤¹þ¤ßÁàºî¤ò³«»Ï¤¹¤ë¡£
156 °ì¤Ä¤Ï¿·¤·¤¯½ñ¤¹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤ËÂФ¹¤ë¤â¤Î¤Ç¤¢¤ê¡¢
157 ¤â¤¦°ì¤Ä¤Ï inode ¤Ë³ÊǼ¤µ¤ì¤ë½¤Àµ»þ¹ï (modification time) ¤ò
158 ¹¹¿·¤¹¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¢¤ë¡£
159 ½¤Àµ»þ¹ï¤Î¹¹¿·¤¬ÉÔ²Äʬ¤ÊÁàºî (¥È¥é¥ó¥¶¥¯¥·¥ç¥ó) ¤Î°ìÉô¤Ç¤Ï¤Ê¤¤¾ì¹ç¡¢
161 ¤ò»È¤¦¤³¤È¤Ç¡¢ÉÔɬÍ×¤Ê inode ¤Î¥Ç¥£¥¹¥¯½ñ¤¹þ¤ßÁàºî¤òÈò¤±¤ë¤³¤È¤¬¤Ç¤¤ë¡£
163 ¥Ç¡¼¥¿¤¬ÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¥Ï¡¼¥É¥Ç¥£¥¹¥¯¤Î½ñ¤¹þ¤ß¥¥ã¥Ã¥·¥å¤¬Í¸ú¤Ë
168 ¤«¤éÌá¤Ã¤Æ¤¤¿¤È¤·¤Æ¤â¡¢¤½¤Î¥Ç¡¼¥¿¤Ï¼ÂºÝ¤Ë¤Ï±Ê³Ū¤Êµ²±ÇÞÂΤË
169 ³ÊǼ¤µ¤ì¤Æ¤¤¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤¡£
170 .\" IDE ¥Ç¥£¥¹¥¯¤Î¥¥ã¥Ã¥·¥å¤ò̵¸ú¤Ë¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤Æ¤Ï
174 ext2 ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤¬
176 ¥ª¥×¥·¥ç¥ó¤Ä¤¤Ç¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
178 ¤Ç¥Ç¥£¥ì¥¯¥È¥ê¡¦¥¨¥ó¥È¥ê¤â°ÅÌۤΤ¦¤Á¤ËƱ´ü¤¹¤ë¡£
180 2.4 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤ÏµðÂç¤Ê¥Õ¥¡¥¤¥ë¤Ë
182 ¤ò»ÈÍѤ¹¤ë¤³¤È¤Ï¸úΨ¤¬°¤¤¾ì¹ç¤¬¤¢¤ë¡£
187 ¥Õ¥é¥°¤ò»ÈÍѤ¹¤ë¤Î¤¬Îɤ¤¤«¤â¤·¤ì¤Ê¤¤¡£
193 ¤ÈÅù²Á¤Ç¤¢¤ê¡¢ÀǽÌ̤ǤΥá¥ê¥Ã¥È¤Ï¤Ê¤¤¡£
198 .BR sync_file_range (2),