OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / release / man2 / fsync.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) and
4 .\" and Copyright 2006 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\"
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.
9 .\"
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.
14 .\"
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
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
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.
37 .\"
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
45 .\"
46 .\"WORD:        core                    ¥á¥â¥ê
47 .\"WORD:        disk                    ¥Ç¥£¥¹¥¯
48 .\"WORD:        synchronize             Æ±´ü¤µ¤»¤ë
49 ..\"
50 .TH FSYNC 2 2008-11-07 "Linux" "Linux Programmer's Manual"
51 .SH Ì¾Á°
52 fsync \- ¥á¥â¥ê¾å¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤ÎÆâÍƤò¥¹¥È¥ì¡¼¥¸¥Ç¥Ð¥¤¥¹¾å¤Î¤â¤Î¤ÈƱ´ü¤µ¤»¤ë
53 .SH ½ñ¼°
54 .B #include <unistd.h>
55 .sp
56 .BI "int fsync(int " fd );
57 .sp
58 .BI "int fdatasync(int " fd );
59 .sp
60 .in -4n
61 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
62 .RB ( feature_test_macros (7)
63 »²¾È):
64 .in
65 .sp
66 .BR fsync ():
67 _BSD_SOURCE || _XOPEN_SOURCE
68 .br
69          || /* glibc 2.8 °Ê¹ß¤Ç¤Ï: */ _POSIX_C_SOURCE\ >=\ 200112L
70 .\" _POSIX_C_SOURCE\ >=\ 200112L ¤Ï glibc 2.8 °Ê¹ß¤Î¤ß
71 .br
72 .BR fdatasync ():
73 _POSIX_C_SOURCE\ >=\ 199309L || _XOPEN_SOURCE\ >=\ 500
74 .SH ÀâÌÀ
75 .BR fsync ()
76 ¤Ï¡¢¥Õ¥¡¥¤¥ëµ­½Ò»Ò
77 .I fd
78 ¤Ç»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤ÎÆâÉô¤Ç»ý¤Ã¤Æ¤¤¤ë¥Ç¡¼¥¿
79 (¤Ä¤Þ¤ê¥Ð¥Ã¥Õ¥¡¥­¥ã¥Ã¥·¥å¥Ú¡¼¥¸) ¤Î¤¦¤Á½¤Àµ¤µ¤ì¤¿¥Ç¡¼¥¿¤ò¡¢
80 ¤½¤Î¥Õ¥¡¥¤¥ë¤¬Â°¤¹¤ë¥Ç¥£¥¹¥¯¥Ç¥Ð¥¤¥¹ (¤Þ¤¿¤Ï¤½¤Î¾¤Î±Ê³¥¹¥È¥ì¡¼¥¸¥Ç¥Ð¥¤¥¹)
81 ¤ËžÁ÷ (¡Ö¥Õ¥é¥Ã¥·¥å¡×) ¤¹¤ë¡£
82 ¤³¤Î¸Æ¤Ó½Ð¤·¤ÏžÁ÷¤¬½ª¤ï¤Ã¤¿¤È¥Ç¥Ð¥¤¥¹¤¬Êó¹ð¤¹¤ë¤Þ¤Ç¥Ö¥í¥Ã¥¯¤¹¤ë¡£
83 ¤Þ¤¿¥Õ¥¡¥¤¥ë¤Ë·ë¤Ó¤Ä¤¤¤¿¥á¥¿¥Ç¡¼¥¿¾ðÊó
84 .RB ( stat (2)
85 »²¾È) ¤â¥Õ¥é¥Ã¥·¥å¤¹¤ë¡£
86
87 .BR fsync ()
88 ¤Î¸Æ¤Ó½Ð¤·¤Ï¡¢¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Æ¤¤¤ë¥Ç¥£¥ì¥¯¥È¥ê¤Î¥¨¥ó¥È¥ê¤¬¥Ç¥£¥¹¥¯¤Ø
89 ½ñ¤­¹þ¤Þ¤ì¤¿¤³¤È¤òÊݾڤ¹¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
90 Êݾڤ¹¤ë¤¿¤á¤Ë¤ÏÌÀ¼¨Åª¤Ë¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¥Õ¥¡¥¤¥ëµ­½Ò»Ò¤ËÂФ·¤Æ¤â
91 .BR fsync ()
92 ¤¹¤ëɬÍפ¬¤¢¤ë¡£
93
94 .BR fdatasync ()
95 ¤Ï
96 .BR fsync ()
97 ¤ÈƱÍͤǤ¢¤ë¤¬¡¢¥á¥¿¥Ç¡¼¥¿¤Î°·¤¤¤¬°Û¤Ê¤ë¡£
98 .BR fdatasync ()
99 ¤Ï¡¢¤½¤ì°Ê¹ß¤Î¥Ç¡¼¥¿Æɤ߹þ¤ß¤òÀµ¤·¤¯°·¤¦¤¿¤á¤Ë¤½¤Î¥á¥¿¥Ç¡¼¥¿¤¬É¬ÍפË
100 ¤Ê¤é¤Ê¤¤¸Â¤ê¡¢Êѹ¹¤µ¤ì¤¿¥á¥¿¥Ç¡¼¥¿¤ò¥Õ¥é¥Ã¥·¥å¤·¤Ê¤¤¡£
101 Î㤨¤Ð¡¢
102 st_atime ¤ä st_mtime
103 (¤½¤ì¤¾¤ìºÇ½ª¥¢¥¯¥»¥¹»þ¹ï¡¢ºÇ½ª½¤Àµ»þ¹ï;
104 .BR stat (2)
105 »²¾È) ¤ÎÊѹ¹¤Ï¥Õ¥é¥Ã¥·¥å¤òɬÍפȤ·¤Ê¤¤¡£
106 ¤Ê¤¼¤Ê¤é¤³¤ì¤é¤Ï¤½¤ì°Ê¹ß¤Î¥Ç¡¼¥¿Æɤ߹þ¤ß¤òÀµ¤·¤¯°·¤¦¤¿¤á¤Ë
107 ɬÍפǤϤʤ¤¤«¤é¤Ç¤¢¤ë¡£
108 °ìÊý¡¢¥Õ¥¡¥¤¥ë¥µ¥¤¥º
109 .RB ( ftruncate (2)
110 ¤Ç¤Ï
111 .IR st_size )
112 ¤ÎÊѹ¹¤Ï¥á¥¿¥Ç¡¼¥¿¤Î¥Õ¥é¥Ã¥·¥å¤¬É¬ÍפǤ¢¤ë¡£
113 .BR fdatasync ()
114 ¤ÎÁÀ¤¤¤Ï¡¢Á´¤Æ¤Î¥á¥¿¥Ç¡¼¥¿¤ò¥Ç¥£¥¹¥¯¤ÈƱ´ü¤¹¤ëɬÍפΤʤ¤
115 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ËÂФ·¤Æ¡¢¥Ç¥£¥¹¥¯¥¢¥¯¥»¥¹¤ò¸º¤é¤¹¤³¤È¤Ç¤¢¤ë¡£
116 .SH ÊÖ¤êÃÍ
117 À®¸ù¤·¤¿¾ì¹ç¡¢¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¥¼¥í¤òÊÖ¤¹¡£
118 ¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤¬ÊÖ¤µ¤ì¡¢
119 .I errno
120 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
121 .SH ¥¨¥é¡¼
122 .TP
123 .B EBADF
124 .I fd
125 ¤¬½ñ¤­¹þ¤ß¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ëµ­½Ò»Ò¤Ç¤Ê¤¤¡£
126 .TP
127 .B EIO
128 Ʊ´üÁàºî¤Î´Ö¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
129 .TP
130 .BR EROFS ", " EINVAL
131 .I fd
132 ¤¬Æ±´üÁàºî¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤Ê¤¤Æüì¤Ê¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤ë¡£
133 .SH ½àµò
134 4.3BSD, POSIX.1-2001.
135 .SH ²ÄÍÑÀ­
136 .BR fdatasync ()
137 ¤¬ÍøÍѲÄǽ¤Ê POSIX ¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
138 .B _POSIX_SYNCHRONIZED_IO
139 ¤¬
140 .I <unistd.h>
141 ¤Ç 0 ¤è¤êÂ礭¤ÊÃͤËÄêµÁ¤µ¤ì¤ë
142 .RB ( sysconf (3)
143 »²¾È)¡£
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.
147 .SH Ãí°Õ
148 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ä¥í¥°¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¡¢
149 Èó¾ï¤Ë¾®¤µ¤Ê¥Ç¡¼¥¿¤ÎÃÇÊҤνñ¤­¹þ¤ß¤ò¹Ô¤¤¡¢¤½¤Î¸å¤¹¤°¤Ë
150 .BR fsync ()
151 ¤ò¸Æ¤Ó½Ð¤·¤Æ¡¢½ñ¤­¹þ¤ó¤À¥Ç¡¼¥¿¤¬¥Ï¡¼¥É¥Ç¥£¥¹¥¯¤ËʪÍýŪ¤Ë
152 ³Î¼Â¤Ë³ÊǼ¤µ¤ì¤ë¤è¤¦¤Ë¤¹¤ë¤³¤È¤¬Â¿¤¤¡£
153 »ÄÇ°¤Ê¤¬¤é¡¢
154 .BR fsync ()
155 ¤Ï¾ï¤Ë 2¤Ä¤Î½ñ¤­¹þ¤ßÁàºî¤ò³«»Ï¤¹¤ë¡£
156 °ì¤Ä¤Ï¿·¤·¤¯½ñ¤­¹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤ËÂФ¹¤ë¤â¤Î¤Ç¤¢¤ê¡¢
157 ¤â¤¦°ì¤Ä¤Ï inode ¤Ë³ÊǼ¤µ¤ì¤ë½¤Àµ»þ¹ï (modification time) ¤ò
158 ¹¹¿·¤¹¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¢¤ë¡£
159 ½¤Àµ»þ¹ï¤Î¹¹¿·¤¬ÉÔ²Äʬ¤ÊÁàºî (¥È¥é¥ó¥¶¥¯¥·¥ç¥ó) ¤Î°ìÉô¤Ç¤Ï¤Ê¤¤¾ì¹ç¡¢
160 .BR fdatasync ()
161 ¤ò»È¤¦¤³¤È¤Ç¡¢ÉÔɬÍפʠinode ¤Î¥Ç¥£¥¹¥¯½ñ¤­¹þ¤ßÁàºî¤òÈò¤±¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
162
163 ¥Ç¡¼¥¿¤¬ÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¥Ï¡¼¥É¥Ç¥£¥¹¥¯¤Î½ñ¤­¹þ¤ß¥­¥ã¥Ã¥·¥å¤¬Í­¸ú¤Ë
164 ¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢
165 .BR fsync ()
166 /
167 .BR fdatasync ()
168 ¤«¤éÌá¤Ã¤Æ¤­¤¿¤È¤·¤Æ¤â¡¢¤½¤Î¥Ç¡¼¥¿¤Ï¼ÂºÝ¤Ë¤Ï±Ê³Ū¤Êµ­²±ÇÞÂΤË
169 ³ÊǼ¤µ¤ì¤Æ¤¤¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤¡£
170 .\" IDE ¥Ç¥£¥¹¥¯¤Î¥­¥ã¥Ã¥·¥å¤ò̵¸ú¤Ë¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤Æ¤Ï
171 .\" .BR hdparm (8)
172 .\" ¤ò»²¾È¤Î¤³¤È¡£
173 .LP
174 ext2 ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤¬
175 .I sync
176 ¥ª¥×¥·¥ç¥ó¤Ä¤­¤Ç¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
177 .BR fsync ()
178 ¤Ç¥Ç¥£¥ì¥¯¥È¥ê¡¦¥¨¥ó¥È¥ê¤â°ÅÌۤΤ¦¤Á¤ËƱ´ü¤¹¤ë¡£
179 .LP
180 2.4 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤ÏµðÂç¤Ê¥Õ¥¡¥¤¥ë¤Ë
181 .BR fsync ()
182 ¤ò»ÈÍѤ¹¤ë¤³¤È¤Ï¸úΨ¤¬°­¤¤¾ì¹ç¤¬¤¢¤ë¡£
183 Ê̤ÎÊýË¡¤È¤·¤Æ
184 .BR open (2)
185 ¤ÎºÝ¤Ë
186 .B O_SYNC
187 ¥Õ¥é¥°¤ò»ÈÍѤ¹¤ë¤Î¤¬Îɤ¤¤«¤â¤·¤ì¤Ê¤¤¡£
188
189 Linux 2.2 °ÊÁ°¤Ç¤Ï¡¢
190 .BR fdatasync ()
191 ¤Ï
192 .BR fsync ()
193 ¤ÈÅù²Á¤Ç¤¢¤ê¡¢À­Ç½Ì̤ǤΥá¥ê¥Ã¥È¤Ï¤Ê¤¤¡£
194 .SH ´ØÏ¢¹àÌÜ
195 .BR bdflush (2),
196 .BR open (2),
197 .BR sync (2),
198 .BR sync_file_range (2),
199 .BR hdparm (8),
200 .BR mount (8),
201 .BR sync (8),
202 .BR update (8)