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