]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/posix_fallocate.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / posix_fallocate.3
CommitLineData
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
7posix_fallocate \- allocate file space
b5f351e7
AC
8.SH LIBRARY
9Standard 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
20Feature 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
29The function
30.BR posix_fallocate ()
31ensures that disk space is allocated for the file referred to by the
d9cb0d7d 32file descriptor
1cd27447
MK
33.I fd
34for the bytes in the range starting at
0daa9e92 35.I offset
c13182ef 36and continuing for
1cd27447
MK
37.I len
38bytes.
39After a successful call to
40.BR posix_fallocate (),
41subsequent writes to bytes in the specified range are
42guaranteed not to fail because of lack of disk space.
847e0d88 43.PP
1cd27447
MK
44If the size of the file is less than
45.IR offset + len ,
46then the file is increased to this size;
47otherwise the file size is left unchanged.
47297adb 48.SH RETURN VALUE
1cd27447
MK
49.BR posix_fallocate ()
50returns zero on success, or an error number on failure.
51Note that
0daa9e92 52.I errno
1cd27447 53is not set.
47297adb 54.SH ERRORS
1cd27447
MK
55.TP
56.B EBADF
57.I fd
58is not a valid file descriptor, or is not opened for writing.
59.TP
60.B EFBIG
61.I offset+len
62exceeds the maximum file size.
63.TP
3fe3c87e
MK
64.B EINTR
65A signal was caught during execution.
66.TP
1cd27447
MK
67.B EINVAL
68.I offset
0c4dba93 69was less than 0, or
1cd27447 70.I len
a74bc4c9
CD
71was less than or equal to 0, or the underlying filesystem does not
72support the operation.
1cd27447
MK
73.TP
74.B ENODEV
75.I fd
76does not refer to a regular file.
77.TP
78.B ENOSPC
c13182ef 79There is not enough space left on the device containing the file
1cd27447 80referred to by
4df883b9 81.IR fd .
1cd27447 82.TP
d5ee3a14
ÉR
83.B EOPNOTSUPP
84The filesystem containing the file referred to by
85.I fd
86does not support this operation.
3af4e973 87This error code can be returned by C libraries that don't perform the
d5ee3a14
ÉR
88emulation shown in NOTES, such as musl libc.
89.TP
1cd27447
MK
90.B ESPIPE
91.I fd
681445c1 92refers to a pipe.
a759cc87 93.SH VERSIONS
1cd27447
MK
94.BR posix_fallocate ()
95is available since glibc 2.1.94.
955269b4 96.SH ATTRIBUTES
83336152
PH
97For 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
102allbox;
b32feea5 103lb lb lbx
83336152
PH
104l l l.
105Interface Attribute Value
106T{
955269b4 107.BR posix_fallocate ()
b32feea5
MK
108T} Thread safety T{
109MT-Safe (but see NOTES)
110T}
83336152 111.TE
c466875e
MK
112.hy
113.ad
114.sp 1
3113c7f3 115.SH STANDARDS
1cd27447 116POSIX.1-2001.
847e0d88 117.PP