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