OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man2 / fallocate.2
1 .\" Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved
2 .\" Written by Dave Chinner <dgc@sgi.com>
3 .\" May be distributed as per GNU General Public License version 2.
4 .\"
5 .\" Japanese Version Copyright (c) 2007  Akihiro MOTOKI
6 .\"         all rights reserved.
7 .\" Translated 2007-10-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.66
8 .\" Updated 2008-10-13, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.11
9 .\" 
10 .TH FALLOCATE 2 2010-09-10 "Linux" "Linux Programmer's Manual"
11 .\"O .SH NAME
12 .SH Ì¾Á°
13 .\"O fallocate \- manipulate file space
14 fallocate \- ¥Õ¥¡¥¤¥ë¶õ´Ö¤ÎÁàºî
15 .\"O .SH SYNOPSIS
16 .SH ½ñ¼°
17 .nf
18 .\"O .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
19 .BR "#define _GNU_SOURCE" "             /* feature_test_macros(7) »²¾È */"
20 .B #include <fcntl.h>
21
22 .BI "int fallocate(int " fd ", int " mode ", off_t " offset \
23 ", off_t " len ");"
24 .fi
25 .\"O .SH DESCRIPTION
26 .SH ÀâÌÀ
27 .\"O This is a nonportable, Linux-specific system call.
28 .\"O For the portable, POSIX.1-specified method of ensuring that space
29 .\"O is allocated for a file, see
30 .\"O .BR posix_fallocate ().
31 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢°Ü¿¢À­¤Î¤Ê¤¤¡¢Linux ¸ÇÍ­¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤¢¤ë¡£
32 °Ü¿¢À­¤¬É¬Íפʾì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¥Ç¥£¥¹¥¯¶õ´Ö¤ò³Î¼Â¤Ë³ÎÊݤ¹¤ë¤¿¤á¤Ë¡¢
33 POSIX.1 ¤Çµ¬Äꤵ¤ì¤¿ÊýË¡¤Ç¤¢¤ë
34 .BR posix_fallocate (3)
35 ¤ò»È¤¦¤³¤È¡£
36
37 .\"O .BR fallocate ()
38 .\"O allows the caller to directly manipulate the allocated disk space
39 .\"O for the file referred to by
40 .\"O .I fd
41 .\"O for the byte range starting at
42 .\"O .I offset
43 .\"O and continuing for
44 .\"O .I len
45 .\"O bytes.
46 .BR fallocate ()
47 ¤ò»È¤¦¤È¡¢
48 .I fd
49 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥Ç¥£¥¹¥¯¶õ´Ö¤òľÀÜÁàºî¤Ç¤­¤ë¡£
50 ÁàºîÂоݤϡ¢
51 .I offset
52 ¤«¤é»Ï¤Þ¤ëŤµ
53 .I len
54 ¥Ð¥¤¥È¤ÎÎΰè¤Ç¤¢¤ë¡£
55
56 .\"O The
57 .\"O .I mode
58 .\"O argument determines the operation to be performed on the given range.
59 .\"O Currently only one flag is supported for
60 .\"O .IR mode :
61 .I mode
62 °ú¤­¿ô¤Ï¡¢»ØÄꤵ¤ì¤¿Îΰè¤ËÂФ·¤Æ¼Â¹Ô¤¹¤ëÁàºî¤ò»ØÄꤹ¤ë¡£
63 ¸½ºß¤Î¤È¤³¤í¡¢
64 .I mode
65 ¤Ë»ØÄê¤Ç¤­¤ë¥Õ¥é¥°¤Ï°Ê²¼¤Î°ì¤Ä¤À¤±¤Ç¤¢¤ë¡£
66 .TP
67 .B FALLOC_FL_KEEP_SIZE
68 .\"O This flag allocates and initializes to zero the disk space
69 .\"O within the range specified by
70 .\"O .I offset
71 .\"O and
72 .\"O .IR len .
73 .\"O After a successful call, subsequent writes into this range
74 .\"O are guaranteed not to fail because of lack of disk space.
75 ¤³¤Î¥Õ¥é¥°¤Ï¡¢
76 .I offset
77 ¤È
78 .I len
79 ¤Ç»ØÄꤵ¤ì¤¿Îΰè¤Î¥Ç¥£¥¹¥¯¶õ´Ö¤ò³ä¤êÅö¤Æ¡¢¤½¤Î¶õ´Ö¤ò 0 ¤Ç½é´ü²½¤¹¤ë¡£
80 ¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È¡¢¤½¤ì¤Ë³¤¤¤Æ¤³¤ÎÎΰè¤Ø¤Î½ñ¤­¹þ¤ß¤¬¹Ô¤ï¤ì¤ë¤¬¡¢
81 ¥Ç¥£¥¹¥¯¶õ´Ö¤ÎÉÔ­¤Ë¤è¤ë½ñ¤­¹þ¤ß¼ºÇÔ¤¬È¯À¸¤·¤Ê¤¤¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
82 .\"O Preallocating zeroed blocks beyond the end of the file
83 .\"O is useful for optimizing append workloads.
84 .\"O Preallocating blocks does not change
85 .\"O the file size (as reported by
86 .\"O .BR stat (2))
87 .\"O even if it is less than
88 .\"O .IR offset + len .
89 ¥Õ¥¡¥¤¥ëËöÈø¤è¤ê¸å¤í¤ÎÎΰè¤Ë¤Ä¤¤¤Æ 0 ¤ÇËä¤á¤¿¥Ö¥í¥Ã¥¯¤òÁ°¤â¤Ã¤Æ
90 ³ä¤êÅö¤Æ¤Æ¤ª¤¯¤³¤È¤Ï¡¢Äɵ­ (append) ¤Îºî¶ÈÉé²Ù¤òºÇŬ²½¤¹¤ë¤Î¤Ë
91 Í­ÍѤǤ¢¤ë¡£
92 ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬
93 .IR offset + len
94 ¤è¤ê¤â¾®¤µ¤¤¾ì¹ç¤Ç¤¢¤Ã¤Æ¤â¡¢¥Ö¥í¥Ã¥¯¤ÎÁ°¤â¤Ã¤Æ¤Î³ä¤êÅö¤Æ¤Ë¤è¤ê
95 .RB ( stat (2)
96 ¤¬ÊÖ¤¹) ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÏÊѹ¹¤µ¤ì¤ë¤³¤È¤Ï¤Ê¤¤¡£
97 .\"
98 .\" Note from Amit Arora:
99 .\" There were few more flags which were discussed, but none of
100 .\" them have been finalized upon. Here are these flags:
101 .\" FA_FL_DEALLOC, FA_FL_DEL_DATA, FA_FL_ERR_FREE, FA_FL_NO_MTIME,
102 .\" FA_FL_NO_CTIME
103 .\" All of the above flags were debated upon and we can not say
104 .\" if any/which one of these flags will make it to the later kernels.
105 .PP
106 .\"O If
107 .\"O .B FALLOC_FL_KEEP_SIZE
108 .\"O flag is not specified in
109 .\"O .IR mode ,
110 .\"O the default behavior is almost same as when this flag is specified.
111 .\"O The only difference is that on success,
112 .\"O the file size will be changed if
113 .\"O .I "offset + len"
114 .\"O is greater than the file size.
115 .\"O This default behavior closely resembles the behavior of the
116 .\"O .BR posix_fallocate (3)
117 .\"O library function,
118 .\"O and is intended as a method of optimally implementing that function.
119 .B FALLOC_FL_KEEP_SIZE
120 ¥Õ¥é¥°¤¬
121 .I mode
122 ¤Ë»ØÄꤵ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¡¢¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï
123 .B FALLOC_FL_KEEP_SIZE
124 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤È¤Û¤È¤ó¤ÉƱ¤¸¤È¤Ê¤ë¡£
125 Í£°ì¤Î°ã¤¤¤Ï¡¢
126 .I "offset + len"
127 ¤¬¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤è¤ê¤âÂ礭¤«¤Ã¤¿¾ì¹ç¡¢¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¤È
128 ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬Êѹ¹¤µ¤ì¤ëÅÀ¤Ç¤¢¤ë¡£
129 ¤³¤Î¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï¡¢¥é¥¤¥Ö¥é¥ê´Ø¿ô
130 .BR posix_fallocate (3)
131 ¤ÎÆ°ºî¤ÈÈó¾ï¤Ë»÷¤Æ¤¤¤ë¡£¤³¤ì¤Ï
132 .BR posix_fallocate (3)
133 ¤òºÇŬ¤Ë¼ÂÁõ¤¹¤ë¼êÃʤòÄ󶡤¹¤ë¤³¤È¤òÌÜŪ¤È¤·¤Æ¤¤¤ë¤«¤é¤Ç¤¢¤ë¡£
134 .PP
135 .\"O Because allocation is done in block size chunks,
136 .\"O .BR fallocate ()
137 .\"O may allocate a larger range than that which was specified.
138 ³ä¤êÅö¤Æ¤Ï¥Ö¥í¥Ã¥¯¥µ¥¤¥ºÃ±°Ì¤Ç¹Ô¤ï¤ì¤ë¤¿¤á¡¢
139 .BR fallocate ()
140 ¤Ï»ØÄꤵ¤ì¤¿¤è¤ê¤âÂ礭¤ÊÎΰè¤ò³ä¤êÅö¤Æ¤ë¤³¤È¤¬¤¢¤ë¡£
141 .\"O .SH RETURN VALUE
142 .SH ÊÖ¤êÃÍ
143 .\"O .BR fallocate ()
144 .\"O returns zero on success, and -1 on failure.
145 .BR fallocate ()
146 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤¹¡£
147 .\"O .SH ERRORS
148 .SH ¥¨¥é¡¼
149 .TP
150 .B EBADF
151 .\"O .I fd
152 .\"O is not a valid file descriptor, or is not opened for writing.
153 .I fd
154 ¤¬Í­¸ú¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¤«¡¢
155 ½ñ¤­¹þ¤ßÍѤȤ·¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
156 .TP
157 .B EFBIG
158 .\"O .IR offset + len
159 .\"O exceeds the maximum file size.
160 .I offset + len
161 ¤¬¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÎºÇÂçÃͤè¤ê¤âÂ礭¤¤¡£
162 .TP
163 .B EINTR
164 .\"O A signal was caught during execution.
165 ¼Â¹ÔÃæ¤Ë¥·¥°¥Ê¥ë¤¬Ê᪤µ¤ì¤¿¡£
166 .TP
167 .B EINVAL
168 .\"O .I offset
169 .\"O was less than 0, or
170 .\"O .I len
171 .\"O was less than or equal to 0.
172 .I offset
173 ¤¬ 0 Ì¤Ëþ¤Ç¤¢¤ë¤«¡¢
174 .I len
175 ¤¬ 0 °Ê²¼¤Ç¤¢¤ë¡£
176 .TP
177 .B EIO
178 .\"O An I/O error occurred while reading from or writing to a file system.
179 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤È¤ÎÆɤ߽ñ¤­Ãæ¤ËÆþ½ÐÎÏ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
180 .TP
181 .B ENODEV
182 .\"O .I fd
183 .\"O does not refer to a regular file or a directory.
184 .\"O (If
185 .\"O .I fd
186 .\"O is a pipe or FIFO, a different error results.)
187 .I fd
188 ¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤«¥Ç¥£¥ì¥¯¥È¥ê¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤
189 .RI ( fd
190 ¤¬¥Ñ¥¤¥×¤ä FIFO ¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¡¢Ê̤Υ¨¥é¡¼¤¬È¯À¸¤¹¤ë)¡£
191 .TP
192 .B ENOSPC
193 .\"O There is not enough space left on the device containing the file
194 .\"O referred to by
195 .\"O .IR fd .
196 .I fd
197 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Ç¥Ð¥¤¥¹¤Ë½½Ê¬¤Ê¶õ¤­Îΰ褬¤Ê¤¤¡£
198 .TP
199 .B ENOSYS
200 .\"O The file system containing the file referred to by
201 .\"O .I fd
202 .\"O does not support this operation.
203 .I fd
204 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
205 »ØÄꤵ¤ì¤¿Áàºî¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£
206 .TP
207 .B EOPNOTSUPP
208 .\"O The
209 .\"O .I mode
210 .\"O is not supported by the file system containing the file referred to by
211 .\"O .IR fd .
212 .I fd
213 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
214 .I mode
215 ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£
216 .\"O .SH VERSIONS
217 .SH ¥Ð¡¼¥¸¥ç¥ó
218 .\"O .BR fallocate ()
219 .\"O is available on Linux since kernel 2.6.23.
220 .\"O Support is provided by glibc since version 2.10.
221 .BR fallocate ()
222 ¤Ï¥«¡¼¥Í¥ë 2.6.23 °Ê¹ß¤Î Linux ¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£
223 glibc ¤Ç¤ÎÂбþ¤Ï¥Ð¡¼¥¸¥ç¥ó 3.10 °Ê¹ß¤Ç¹Ô¤ï¤ì¤Æ¤¤¤ë¡£
224 .\"O .SH CONFORMING TO
225 .SH ½àµò
226 .\"O .BR fallocate ()
227 .\"O is Linux-specific.
228 .BR fallocate ()
229 ¤Ï Linux ¸ÇÍ­¤Ç¤¢¤ë¡£
230 .\"O .SH SEE ALSO
231 .SH ´ØÏ¢¹àÌÜ
232 .BR ftruncate (2),
233 .BR posix_fadvise (3),
234 .BR posix_fallocate (3)