OSDN Git Service

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