]>
Commit | Line | Data |
---|---|---|
a1eaacb1 | 1 | '\" t |
f50f6cb5 | 2 | .\" Copyright (c) 2006, Michael Kerrisk <mtk.manpages@gmail.com> |
1cd27447 | 3 | .\" |
5fbde956 | 4 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
1cd27447 | 5 | .\" |
4c1c5274 | 6 | .TH posix_fallocate 3 (date) "Linux man-pages (unreleased)" |
1cd27447 MK |
7 | .SH NAME |
8 | posix_fallocate \- allocate file space | |
b5f351e7 AC |
9 | .SH LIBRARY |
10 | Standard C library | |
8fc3b2cf | 11 | .RI ( libc ", " \-lc ) |
1cd27447 MK |
12 | .SH SYNOPSIS |
13 | .nf | |
063a2574 | 14 | .B #include <fcntl.h> |
68e4db0a | 15 | .PP |
1cd27447 | 16 | .BI "int posix_fallocate(int " fd ", off_t " offset ", off_t " len ); |
1cd27447 | 17 | .fi |
68e4db0a | 18 | .PP |
9a30939e | 19 | .ad l |
d39ad78f | 20 | .RS -4 |
9a30939e MK |
21 | Feature Test Macro Requirements for glibc (see |
22 | .BR feature_test_macros (7)): | |
d39ad78f | 23 | .RE |
68e4db0a | 24 | .PP |
9a30939e | 25 | .BR posix_fallocate (): |
9d2adbae | 26 | .nf |
5c10d2c5 | 27 | _POSIX_C_SOURCE >= 200112L |
9d2adbae | 28 | .fi |
1cd27447 MK |
29 | .SH DESCRIPTION |
30 | The function | |
31 | .BR posix_fallocate () | |
32 | ensures that disk space is allocated for the file referred to by the | |
d9cb0d7d | 33 | file descriptor |
1cd27447 MK |
34 | .I fd |
35 | for the bytes in the range starting at | |
0daa9e92 | 36 | .I offset |
c13182ef | 37 | and continuing for |
1cd27447 MK |
38 | .I len |
39 | bytes. | |
40 | After a successful call to | |
41 | .BR posix_fallocate (), | |
42 | subsequent writes to bytes in the specified range are | |
43 | guaranteed not to fail because of lack of disk space. | |
847e0d88 | 44 | .PP |
1cd27447 MK |
45 | If the size of the file is less than |
46 | .IR offset + len , | |
47 | then the file is increased to this size; | |
48 | otherwise the file size is left unchanged. | |
47297adb | 49 | .SH RETURN VALUE |
1cd27447 MK |
50 | .BR posix_fallocate () |
51 | returns zero on success, or an error number on failure. | |
52 | Note that | |
0daa9e92 | 53 | .I errno |
1cd27447 | 54 | is not set. |
47297adb | 55 | .SH ERRORS |
1cd27447 MK |
56 | .TP |
57 | .B EBADF | |
58 | .I fd | |
59 | is not a valid file descriptor, or is not opened for writing. | |
60 | .TP | |
61 | .B EFBIG | |
62 | .I offset+len | |
63 | exceeds the maximum file size. | |
64 | .TP | |
3fe3c87e MK |
65 | .B EINTR |
66 | A signal was caught during execution. | |
67 | .TP | |
1cd27447 MK |
68 | .B EINVAL |
69 | .I offset | |
0c4dba93 | 70 | was less than 0, or |
1cd27447 | 71 | .I len |
a74bc4c9 CD |
72 | was less than or equal to 0, or the underlying filesystem does not |
73 | support the operation. | |
1cd27447 MK |
74 | .TP |
75 | .B ENODEV | |
76 | .I fd | |
77 | does not refer to a regular file. | |
78 | .TP | |
79 | .B ENOSPC | |
c13182ef | 80 | There is not enough space left on the device containing the file |
1cd27447 | 81 | referred to by |
4df883b9 | 82 | .IR fd . |
1cd27447 | 83 | .TP |
d5ee3a14 ÉR |
84 | .B EOPNOTSUPP |
85 | The filesystem containing the file referred to by | |
86 | .I fd | |
87 | does not support this operation. | |
3af4e973 | 88 | This error code can be returned by C libraries that don't perform the |
d5ee3a14 ÉR |
89 | emulation shown in NOTES, such as musl libc. |
90 | .TP | |
1cd27447 MK |
91 | .B ESPIPE |
92 | .I fd | |
681445c1 | 93 | refers to a pipe. |
955269b4 | 94 | .SH ATTRIBUTES |
83336152 PH |
95 | For an explanation of the terms used in this section, see |
96 | .BR attributes (7). | |
c466875e MK |
97 | .ad l |
98 | .nh | |
83336152 PH |
99 | .TS |
100 | allbox; | |
b32feea5 | 101 | lb lb lbx |
83336152 PH |
102 | l l l. |
103 | Interface Attribute Value | |
104 | T{ | |
955269b4 | 105 | .BR posix_fallocate () |
b32feea5 MK |
106 | T} Thread safety T{ |
107 | MT-Safe (but see NOTES) | |
108 | T} | |
83336152 | 109 | .TE |
c466875e MK |
110 | .hy |
111 | .ad | |
112 | .sp 1 | |
196224f7 AC |
113 | .SH VERSIONS |
114 | .BR posix_fallocate () | |
115 | is available since glibc 2.1.94. | |
3113c7f3 | 116 | .SH STANDARDS |
1cd27447 | 117 | POSIX.1-2001. |
847e0d88 | 118 | .PP |