OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / release / man2 / sync_file_range.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 2006 Andrew Morton <akpm@osdl.org>
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 .\" 2006-07-05 Initial creation, Michael Kerrisk based on
27 .\"     Andrew Morton's comments in fs/sync.c
28 .\"
29 .\" Japanese Version Copyright (c) 2007 Akihiro MOTOKI
30 .\"         all rights reserved.
31 .\" Translated 2007-01-09, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.43
32 .\" Updated 2008-08-06, Akihiro MOTOKI, LDP v3.05
33 .\" Updated 2010-04-23, Akihiro MOTOKI, LDP v3.24
34 .\"
35 .TH SYNC_FILE_RANGE 2 2010-01-17 "Linux" "Linux Programmer's Manual"
36 .SH Ì¾Á°
37 sync_file_range \- ¥Õ¥¡¥¤¥ë¥»¥°¥á¥ó¥È¤ò¥Ç¥£¥¹¥¯¤ÈƱ´ü¤¹¤ë
38 .SH ½ñ¼°
39 .nf
40 .BR "#define _GNU_SOURCE" "         /* feature_test_macros(7) »²¾È */"
41 .B #include <fcntl.h>
42
43 .BI "int sync_file_range(int " fd ", off64_t " offset ", off64_t " nbytes ,
44 .BI "                    unsigned int " flags );
45 .fi
46 .SH ÀâÌÀ
47 .BR sync_file_range ()
48 ¤ò»È¤¦¤È¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
49 .I fd
50 ¤Ç»²¾È¤µ¤ì¤ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤Î¥Ç¥£¥¹¥¯¤È¤ÎƱ´ü¤Ë´Ø¤·¤Æ¡¢
51 ¤­¤áºÙ¤«¤ÊÀ©¸æ¤¬²Äǽ¤È¤Ê¤ë¡£
52
53 .I offset
54 ¤Ï¡¢Æ±´ü¤ò¹Ô¤¦¥Õ¥¡¥¤¥ë¤ÎÎΰè¤Î³«»Ï¥Ð¥¤¥È¤Ç¤¢¤ë¡£
55 .I nbytes
56 ¤Ë¤ÏƱ´ü¤ò¹Ô¤¦Îΰè¤ÎŤµ¤ò¥Ð¥¤¥Èñ°Ì¤Ç»ØÄꤹ¤ë¡£
57 .I nbytes
58 ¤¬ 0 ¤Î¾ì¹ç¤Ï¡¢
59 .I offset
60 ¤«¤é¥Õ¥¡¥¤¥ëËöÈø¤Þ¤Ç¤ÎÁ´¥Ð¥¤¥È¤òƱ´ü¤¹¤ë¡£
61 Ʊ´ü¤Ï¥·¥¹¥Æ¥à¤Î¥Ú¡¼¥¸¥µ¥¤¥º¤Îñ°Ì¤Ç¹Ô¤ï¤ì¤ë¡£
62 .I offset
63 ¤Ï¥Ú¡¼¥¸¶­³¦¤Ë¤¢¤ï¤»¤ÆÀڤ겼¤²¤é¤ì¡¢
64 .I (offset+nbytes-1)
65 ¤Ï¥Ú¡¼¥¸¶­³¦¤Ë¤¢¤ï¤»¤ÆÀÚ¤ê¾å¤²¤é¤ì¤ë¡£
66
67 ¥Ó¥Ã¥È¥Þ¥¹¥¯°ú¤­¿ô
68 .I flags
69 ¤Ë¤Ï°Ê²¼¤ÎÃͤò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤ë:
70 .TP
71 .B SYNC_FILE_RANGE_WAIT_BEFORE
72 ²¿¤é¤«¤Î½ñ¤­¹þ¤ß¤ò¹Ô¤¦Á°¤Ë¡¢»ØÄꤵ¤ì¤¿Îΰè¤Î¥Ú¡¼¥¸¤Ç
73 ½ñ¤­½Ð¤·¤ò¹Ô¤¦¤è¤¦¤Ë¥Ç¥Ð¥¤¥¹¥É¥é¥¤¥Ð¤Ë¤¹¤Ç¤ËÍ׵᤬ȯ¹Ô¤µ¤ì¤Æ¤¤¤ë
74 ¥Ú¡¼¥¸¤Î½ñ¤­½Ð¤·¤¬Á´¤Æ´°Î»¤¹¤ë¤Î¤òÂԤġ£
75 .TP
76 .B SYNC_FILE_RANGE_WRITE
77 »ØÄꤵ¤ì¤¿Îΰè¤Î¥Ú¡¼¥¸¤Ç¡¢½ñ¤­½Ð¤·Í׵᤬ȯ¹Ô¤µ¤ì¤Æ¤¤¤Ê¤¤
78 Á´¤Æ¤Î dirty (¥­¥ã¥Ã¥·¥å¤À¤±¤¬Êѹ¹¤µ¤ì¤Æ¤¤¤ë) ¥Ú¡¼¥¸¤Î
79 ½ñ¤­½Ð¤·¤ò³«»Ï¤¹¤ë¡£
80 ¥ê¥¯¥¨¥¹¥È¥­¥å¡¼¤ÎÂ礭¤µ¤è¤ê¿¤¯½ñ¤­¹þ¤â¤¦¤È¤·¤¿¾ì¹ç¤Ë¤Ï¡¢
81 ¤³¤Î½èÍý¤ÏÄä»ß (block) ¤¹¤ë²ÄǽÀ­¤¬¤¢¤ëÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
82 .TP
83 .B SYNC_FILE_RANGE_WAIT_AFTER
84 ²¿¤é¤«¤Î½ñ¤­¹þ¤ß¸å¤Ë¡¢»ØÄꤵ¤ì¤¿Îΰè¤ÎÁ´¤Æ¤Î¥Ú¡¼¥¸¤Î
85 ½ñ¤­½Ð¤·¤¬¹Ô¤ï¤ì¤ë¤Î¤òÂԤġ£
86 .PP
87 .I flags
88 ¤Ë 0 ¤ò»ØÄꤷ¤¿¾ì¹ç¡¢²¿¤â¤·¤Ê¤¤¤³¤È¤òɽ¤¹¡£
89 .SS ·Ù¹ð
90 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÏÈó¾ï¤Ë´í¸±¤Ç¤¢¤ê¡¢
91 °Ü¿¢À­¤¬É¬Í×¤Ê¥×¥í¥°¥é¥à¤Ç»ÈÍѤ¹¤Ù¤­¤Ç¤Ï¤Ê¤¤¡£
92 ¤³¤ì¤é¤ÎÁàºî¤Ç¤Ï¤É¤ì¤â¥Õ¥¡¥¤¥ë¤Î¥á¥¿¥Ç¡¼¥¿¤Î½ñ¤­½Ð¤·¤ò¹Ô¤ï¤Ê¤¤¡£
93 ¤·¤¿¤¬¤Ã¤Æ¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë¤è¤êºîÀ®ºÑ¤ß¤Î¥Ç¥£¥¹¥¯¥Ö¥í¥Ã¥¯¤Î
94 ¾å½ñ¤­¤Î¼Â¹Ô¤¬³Î¼Â¤Ë¹Ô¤ï¤ì¤Ê¤¤¸Â¤ê¡¢¥¯¥é¥Ã¥·¥å¤Î¸å¤Ç¤â¥Ç¡¼¥¿¤¬
95 ÍøÍѤǤ­¤ëÊݾڤϤʤ¤¡£
96 ½ñ¤­¹þ¤ß¤¬¾å½ñ¤­¤À¤±¤Ç¤¢¤ë¤«¤òÃΤ뤿¤á¤Î¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ï¸ºß¤·¤Ê¤¤¡£
97 .RI ( btrfs
98 ¤Ê¤É¤Î) copy-on-write Æ°ºî¤ò»È¤Ã¤¿¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
99 ´û¸¤Î³ä¤êÅö¤ÆºÑ¤ß¤Î¥Ö¥í¥Ã¥¯¤ËÂФ¹¤ë¾å½ñ¤­¼«ÂΤ¬¤Ç¤­¤Ê¤¤¡£
100 Á°¤â¤Ã¤Æ³ä¤êÅö¤Æ¤é¤ì¤¿Îΰè¤Ë½ñ¤­¹þ¤ß¤ò¹Ô¤¦¾ì¹ç¡¢
101 ¿¤¯¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ç¤Ï block allocator ¤Ø¤Î½ñ¤­¹þ¤ß¤âɬÍפȤʤ뤬¡¢
102 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï block allocator ¤Î¥Ç¥£¥¹¥¯¤Ø¤ÎƱ´ü¤ò¹Ô¤ï¤Ê¤¤¡£
103 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¥Ç¥£¥¹¥¯½ñ¤­¹þ¤ß¥­¥ã¥Ã¥·¥å¤Î¥Õ¥é¥Ã¥·¥å¤ò
104 ¹Ô¤ï¤Ê¤¤¤Î¤Ç¡¢´øȯÀ­¤Î¥Ç¥£¥¹¥¯½ñ¤­¹þ¤ß¥­¥ã¥Ã¥·¥å¤ò»È¤Ã¤¿¥·¥¹¥Æ¥à¤Ç¤Ï
105 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤Ï¥Ç¡¼¥¿¤Î°ì´ÓÀ­¤ò³ÎÊݤǤ­¤Ê¤¤¤³¤È¤Ë¤Ê¤ë¡£
106 .SS ¾ÜºÙ
107 .B SYNC_FILE_RANGE_WAIT_BEFORE
108 ¤È
109 .B SYNC_FILE_RANGE_WAIT_AFTER
110 ¤Ï I/O ¥¨¥é¡¼¤ä
111 .B ENOSPC
112 ¾õÂÖ¤ò¸¡½Ð¤·¡¢¸Æ¤Ó½Ð¤·¸µ¤Ë¤³¤ì¤é¤Î¾ðÊó¤òÊÖ¤¹¡£
113
114 .I flags
115 ¤ÎÌò¤ËΩ¤Ä¥Ó¥Ã¥È¤ÎÁȤ߹ç¤ï¤»¤ò°Ê²¼¤Ë¼¨¤¹:
116 .TP
117 .B SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE
118 »ØÄꤵ¤ì¤¿ÈÏ°ÏÆâ¤Î¥Ú¡¼¥¸¤Ç¡¢
119 .BR sync_file_range ()
120 ¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿ºÝ¤Ë dirty ¤Ç¤¢¤Ã¤¿Á´¤Æ¤Î¥Ú¡¼¥¸¤¬¡¢
121 ³Î¼Â¤Ë½ñ¤­½Ð¤·ÂоݤȤʤë¤è¤¦¤Ë¤¹¤ë¡£
122 ¤³¤ì¤Ï¡¢start-write-for-data-integrity Áàºî
123 (¥Ç¡¼¥¿´°Á´À­³ÎÊݤΤ¿¤á¤Î½ñ¤­¹þ¤ß³«»Ï¤ÎÁàºî) ¤Ç¤¢¤ë¡£
124 .TP
125 .B SYNC_FILE_RANGE_WRITE
126 »ØÄꤵ¤ì¤¿ÈÏ°ÏÆâ¤Î¥Ú¡¼¥¸¤Ç¡¢¸½ºß½ñ¤­½Ð¤·Ãæ¤Ç¤Ê¤¤Á´¤Æ¤Î dirty ¥Ú¡¼¥¸¤Î
127 ½ñ¤­½Ð¤·¤ò³«»Ï¤¹¤ë¡£¤³¤ì¤ÏÈóƱ´ü¤Î¥Ç¥£¥¹¥¯¤Ø¤Î¥Õ¥é¥Ã¥·¥å (flush-to-disk)
128 Áàºî¤Ç¤¢¤ë¡£¥Ç¡¼¥¿´°Á´À­³ÎÊݤ¬É¬ÍפÊÁàºî¤È¤·¤Æ¤ÏŬÀڤǤϤʤ¤¡£
129 .TP
130 .BR SYNC_FILE_RANGE_WAIT_BEFORE " (or " SYNC_FILE_RANGE_WAIT_AFTER )
131 »ØÄꤵ¤ì¤¿ÈÏ°ÏÆâ¤ÎÁ´¤Æ¤Î¥Ú¡¼¥¸¤Î½ñ¤­½Ð¤·¤Î´°Î»¤òÂԤġ£
132 ¤³¤Î¥Õ¥é¥°¤Ï¡¢Á°¤Ë¹Ô¤ï¤ì¤¿Áàºî
133 .B SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE
134 ¤Î¸å¤Ë»ÈÍѤǤ­¡¢¤³¤ÎÁàºî¤Î´°Î»¤òÂÔ¤Á¡¢·ë²Ì¤ò¼èÆÀ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
135 .TP
136 .B SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | \
137 SYNC_FILE_RANGE_WAIT_AFTER
138 ¤³¤ì¤Ï write-for-data-integrity Áàºî
139 (¥Ç¡¼¥¿´°Á´À­³ÎÊݤΤ¿¤á¤Î½ñ¤­¹þ¤ß) ¤Ç¤¢¤ê¡¢»ØÄꤵ¤ì¤¿ÈÏ°ÏÆâ¤Î¡¢
140 .BR sync_file_range ()
141 ¤¬¸Æ¤Ð¤ì¤¿»þÅÀ¤Ç dirty ¤ÊÁ´¤Æ¤Î¥Ú¡¼¥¸¤¬
142 ¥Ç¥£¥¹¥¯¤Ë³ÊǼ¤µ¤ì¤ë¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
143 .SH ÊÖ¤êÃÍ
144 À®¸ù¤Î¾ì¹ç¡¢
145 .BR sync_file_range ()
146 ¤Ï 0 ¤òÊÖ¤¹¡£¼ºÇԤξì¹ç¡¢\-1 ¤òÊÖ¤·¡¢
147 .I error
148 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹ÃͤòÀßÄꤹ¤ë¡£
149 .SH ¥¨¥é¡¼
150 .TP
151 .B EBADF
152 .I fd
153 ¤¬Í­¸ú¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ï¤Ê¤¤¡£
154 .TP
155 .B EINVAL
156 .I flags
157 ¤ËÉÔÀµ¤Ê¥Ó¥Ã¥È¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¡£¤Þ¤¿¤Ï
158 .I offset
159 ¤«
160 .I nbytes
161 ¤¬ÉÔÀµ¤Ç¤¢¤ë¡£
162 .TP
163 .B EIO
164 I/O ¥¨¥é¡¼¡£
165 .TP
166 .B ENOMEM
167 ¥á¥â¥êÉÔ­¤Ç¤¢¤ë¡£
168 .TP
169 .B ENOSPC
170 ¥Ç¥£¥¹¥¯ÎΰèÉÔ­¤Ç¤¢¤ë¡£
171 .TP
172 .B ESPIPE
173 .I fd
174 ¤¬¡¢Ä̾ï¤Î¥Õ¥¡¥¤¥ë¡¢¥Ö¥í¥Ã¥¯¥Ç¥Ð¥¤¥¹¡¢¥Ç¥£¥ì¥¯¥È¥ê¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯
175 °Ê³°¤Î¤â¤Î¤ò»Ø¤·¤Æ¤¤¤ë¡£
176 .\" FIXME . (bug?) Actually, how can 'fd' refer to a symbolic link (S_ISLNK)?
177 .\" (In userspace at least) it isn't possible to obtain a file descriptor
178 .\" for a symbolic link.
179 .SH ¥Ð¡¼¥¸¥ç¥ó
180 .BR sync_file_range ()
181 ¤Ï¥«¡¼¥Í¥ë 2.6.17 ¤Ç Linux ¤ËÅо줷¤¿¡£
182 .SH ½àµò
183 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux Æȼ«¤Ç¤¢¤ê¡¢
184 °Ü¿¢À­¤¬É¬Í×¤Ê¥×¥í¥°¥é¥à¤Ç¤Ï»ÈÍѤòÈò¤±¤ë¤Ù¤­¤Ç¤¢¤ë¡£
185 .SH ´ØÏ¢¹àÌÜ
186 .BR fdatasync (2),
187 .BR fsync (2),
188 .BR msync (2),
189 .BR sync (2)