OSDN Git Service

fed04b3002ae368d27dd0f61e658a2a8e2e73430
[linuxjm/LDP_man-pages.git] / draft / man3 / posix_fallocate.3
1 .\" Copyright (c) 2006, Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Japanese Version Copyright (c) 2006 Yuichi SATO
24 .\"         all rights reserved.
25 .\" Translated 2006-07-13, Yuichi SATO <ysato444@yahoo.co.jp>. LDP v2.29
26 .\" Updated 2010-04-11, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.24
27 .\"
28 .TH POSIX_FALLOCATE 3  2010-09-20 "GNU" "Linux Programmer's Manual"
29 .\"O .SH NAME
30 .SH Ì¾Á°
31 .\"O posix_fallocate \- allocate file space
32 posix_fallocate \- ¥Õ¥¡¥¤¥ë¤Î¥¹¥Ú¡¼¥¹¤ò³ÎÊݤ¹¤ë
33 .\"O .SH SYNOPSIS
34 .SH ½ñ¼°
35 .nf
36 .B #include <fcntl.h>
37 .sp
38 .BI "int posix_fallocate(int " fd ", off_t " offset ", off_t " len );
39 .fi
40 .sp
41 .ad l
42 .in -4n
43 .\"O Feature Test Macro Requirements for glibc (see
44 .\"O .BR feature_test_macros (7)):
45 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
46 .RB ( feature_test_macros (7)
47 »²¾È):
48 .in
49 .sp
50 .BR posix_fallocate ():
51 .RS 4
52 _XOPEN_SOURCE\ >=\ 600 || _POSIX_C_SOURCE\ >=\ 200112L
53 .RE
54 .ad
55 .\"O .SH DESCRIPTION
56 .SH ÀâÌÀ
57 .\"O The function
58 .\"O .BR posix_fallocate ()
59 .\"O ensures that disk space is allocated for the file referred to by the
60 .\"O descriptor
61 .\"O .I fd
62 .\"O for the bytes in the range starting at
63 .\"O .I offset
64 .\"O and continuing for
65 .\"O .I len
66 .\"O bytes.
67 ´Ø¿ô
68 .BR posix_fallocate ()
69 ¤Ï¡¢¥Ç¥£¥¹¥¯¥ê¥×¥¿
70 .I fd
71 ¤Ç»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¡¢¥Ç¥£¥¹¥¯¥¹¥Ú¡¼¥¹¤ò³Î¼Â¤Ë³ÎÊݤ¹¤ë¡£
72 ¥Ç¥£¥¹¥¯¥¹¥Ú¡¼¥¹¤Ï
73 .I offset
74 ¤«¤é»Ï¤Þ¤ë
75 .I len
76 ¥Ð¥¤¥È¤ÎÈϰϤΥХ¤¥È¤Ç¤¢¤ë¡£
77 .\"O After a successful call to
78 .\"O .BR posix_fallocate (),
79 .\"O subsequent writes to bytes in the specified range are
80 .\"O guaranteed not to fail because of lack of disk space.
81 .BR posix_fallocate ()
82 ¤Î¸Æ¤Ó½Ð¤·¤¬À®¸ù¤·¤¿¸å¡¢»ØÄꤵ¤ì¤¿ÈϰϤΥХ¤¥È¤ËÂФ¹¤ë½ñ¤­¹þ¤ß¤Ï¡¢
83 ¥Ç¥£¥¹¥¯¥¹¥Ú¡¼¥¹¤ÎÉÔ­¤Ç¼ºÇÔ¤·¤Ê¤¤¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
84
85 .\"O If the size of the file is less than
86 .\"O .IR offset + len ,
87 .\"O then the file is increased to this size;
88 .\"O otherwise the file size is left unchanged.
89 ¥Õ¥¡¥¤¥ë¤Î¥µ¥¤¥º¤¬
90 .IR offset + len
91 ¤è¤ê¾®¤µ¤¤¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¤Ï¤³¤Î¥µ¥¤¥º¤Ë¤Ê¤ë¤è¤¦¤Ë³ÈÂ礵¤ì¤ë¡£
92 ¤½¤ì°Ê³°¤Î¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÏÊѤï¤é¤Ê¤¤¡£
93 .\"O .SH "RETURN VALUE"
94 .SH ÊÖ¤êÃÍ
95 .\"O .BR posix_fallocate ()
96 .\"O returns zero on success, or an error number on failure.
97 .BR posix_fallocate ()
98 ¤ÏÀ®¸ù¤·¤¿¾ì¹ç¡¢0 ¤òÊÖ¤¹¡£
99 ¼ºÇÔ¤·¤¿¾ì¹ç¡¢¥¨¥é¡¼ÈÖ¹æ¤òÊÖ¤¹¡£
100 .\"O Note that
101 .\"O .I errno
102 .\"O is not set.
103 .I errno
104 ¤¬ÀßÄꤵ¤ì¤Ê¤¤ÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
105 .\"O .SH "ERRORS"
106 .SH ¥¨¥é¡¼
107 .TP
108 .B EBADF
109 .\"O .I fd
110 .\"O is not a valid file descriptor, or is not opened for writing.
111 .I fd
112 ¤¬Í­¸ú¤Ê¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¡£
113 ¤Þ¤¿¤Ï½ñ¤­¹þ¤ßÍѤ˥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
114 .TP
115 .B EFBIG
116 .\"O .I offset+len
117 .\"O exceeds the maximum file size.
118 .I offset+len
119 ¤¬ºÇÂç¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤òĶ¤¨¤Æ¤¤¤ë¡£
120 .TP
121 .B EINVAL
122 .\"O .I offset
123 .\"O was less than 0, or
124 .\"O .I len
125 .\"O was less than or equal to 0.
126 .I offset
127 ¤¬ 0 Ì¤Ëþ¤À¤Ã¤¿¤«¡¢
128 .I len
129 ¤¬ 0 °Ê²¼¤À¤Ã¤¿¡£
130 .TP
131 .B ENODEV
132 .\"O .I fd
133 .\"O does not refer to a regular file.
134 .I fd
135 ¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤È¤·¤Æ»²¾È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
136 .TP
137 .B ENOSPC
138 .\"O There is not enough space left on the device containing the file
139 .\"O referred to by
140 .\"O .IR fd .
141 .I fd
142 ¤Ç»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¥Ç¥Ð¥¤¥¹¤Ë¡¢½½Ê¬¤Ê¥¹¥Ú¡¼¥¹¤¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¡£
143 .TP
144 .B ESPIPE
145 .\"O .I fd
146 .\"O refers to a pipe of file descriptor.
147 .I fd
148 ¤¬¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¥Ñ¥¤¥×¤ò»²¾È¤·¤Æ¤¤¤ë¡£
149 .\"O .SH VERSIONS
150 .SH ¥Ð¡¼¥¸¥ç¥ó
151 .\"O .BR posix_fallocate ()
152 .\"O is available since glibc 2.1.94.
153 .BR posix_fallocate ()
154 ¤Ï glibc 2.1.94 °Ê¹ß¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£
155 .\"O .SH "CONFORMING TO"
156 .SH ½àµò
157 POSIX.1-2001.
158
159 .\"O POSIX.1-2008 says that an implementation
160 .\"O .I shall
161 .\"O give the
162 .\"O .B EINVAL
163 .\"O error if
164 .\"O .I len
165 .\"O was 0, or
166 .\"O .I offset
167 .\"O was less than 0.
168 POSIX.1-2008 ¤Ç¤Ï¡¢
169 .I len
170 ¤¬ 0 ¤Î¾ì¹ç¡¢¤â¤·¤¯¤Ï
171 .I offset
172 ¤¬ 0 Ì¤Ëþ¤Î¾ì¹ç¡¢
173 .B EINVAL
174 ¥¨¥é¡¼¤òÊÖ¤¹¤â¤Î¤È¤µ¤ì¤Æ¤¤¤ë¡£
175 .\"O POSIX.1-2001 says that an implementation
176 .\"O .I shall
177 .\"O give the
178 .\"O .B EINVAL
179 .\"O error if
180 .\"O .I len
181 .\"O is less than 0, or
182 .\"O .I offset
183 .\"O was less than 0, and
184 .\"O .I may
185 .\"O give the error if
186 .\"O .I len
187 .\"O equals zero.
188 POSIX.1-2001 ¤Ç¤Ï¡¢
189 .I len
190 ¤¬ 0 Ì¤Ëþ¤Î¾ì¹ç¡¢¤â¤·¤¯¤Ï
191 .I offset
192 ¤¬ 0 Ì¤Ëþ¤Î¾ì¹ç¡¢
193 .B EINVAL
194 ¥¨¥é¡¼¤òÊÖ¤¹¤â¤Î¤È¤µ¤ì¤Æ¤¤¤ë¡£¤Þ¤¿¡¢
195 .I len
196 ¤¬ 0 ¤Î¾ì¹ç¡¢
197 .B EINVAL
198 ¥¨¥é¡¼¤òÊÖ¤·¤Æ¤â¤è¤¤¤È¤µ¤ì¤Æ¤¤¤ë¡£
199 .\"O .SH "SEE ALSO"
200 .SH ´ØÏ¢¹àÌÜ
201 .BR fallocate (2),
202 .BR lseek (2),
203 .BR posix_fadvise (2)