]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/posix_fallocate.3
prctl.2: Clarify the unsupported hardware case of EINVAL
[thirdparty/man-pages.git] / man3 / posix_fallocate.3
CommitLineData
f50f6cb5 1.\" Copyright (c) 2006, Michael Kerrisk <mtk.manpages@gmail.com>
1cd27447 2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
1cd27447
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
1cd27447
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
1cd27447
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
1cd27447 24.\"
4b8c67d9 25.TH POSIX_FALLOCATE 3 2017-09-15 "GNU" "Linux Programmer's Manual"
1cd27447
MK
26.SH NAME
27posix_fallocate \- allocate file space
28.SH SYNOPSIS
29.nf
063a2574 30.B #include <fcntl.h>
68e4db0a 31.PP
1cd27447 32.BI "int posix_fallocate(int " fd ", off_t " offset ", off_t " len );
1cd27447 33.fi
68e4db0a 34.PP
9a30939e
MK
35.ad l
36.in -4n
37Feature Test Macro Requirements for glibc (see
38.BR feature_test_macros (7)):
39.in
68e4db0a 40.PP
9a30939e
MK
41.BR posix_fallocate ():
42.RS 4
a446ac0c 43_POSIX_C_SOURCE\ >=\ 200112L
9a30939e
MK
44.RE
45.ad
1cd27447
MK
46.SH DESCRIPTION
47The function
48.BR posix_fallocate ()
49ensures that disk space is allocated for the file referred to by the
d9cb0d7d 50file descriptor
1cd27447
MK
51.I fd
52for the bytes in the range starting at
0daa9e92 53.I offset
c13182ef 54and continuing for
1cd27447
MK
55.I len
56bytes.
57After a successful call to
58.BR posix_fallocate (),
59subsequent writes to bytes in the specified range are
60guaranteed not to fail because of lack of disk space.
847e0d88 61.PP
1cd27447
MK
62If the size of the file is less than
63.IR offset + len ,
64then the file is increased to this size;
65otherwise the file size is left unchanged.
47297adb 66.SH RETURN VALUE
1cd27447
MK
67.BR posix_fallocate ()
68returns zero on success, or an error number on failure.
69Note that
0daa9e92 70.I errno
1cd27447 71is not set.
47297adb 72.SH ERRORS
1cd27447
MK
73.TP
74.B EBADF
75.I fd
76is not a valid file descriptor, or is not opened for writing.
77.TP
78.B EFBIG
79.I offset+len
80exceeds the maximum file size.
81.TP
3fe3c87e
MK
82.B EINTR
83A signal was caught during execution.
84.TP
1cd27447
MK
85.B EINVAL
86.I offset
0c4dba93 87was less than 0, or
1cd27447 88.I len
a74bc4c9
CD
89was less than or equal to 0, or the underlying filesystem does not
90support the operation.
1cd27447
MK
91.TP
92.B ENODEV
93.I fd
94does not refer to a regular file.
95.TP
96.B ENOSPC
c13182ef 97There is not enough space left on the device containing the file
1cd27447 98referred to by
4df883b9 99.IR fd .
1cd27447
MK
100.TP
101.B ESPIPE
102.I fd
681445c1 103refers to a pipe.
a759cc87 104.SH VERSIONS
1cd27447
MK
105.BR posix_fallocate ()
106is available since glibc 2.1.94.
955269b4 107.SH ATTRIBUTES
83336152
PH
108For an explanation of the terms used in this section, see
109.BR attributes (7).
110.TS
111allbox;
112lb lb lb
113l l l.
114Interface Attribute Value
115T{
955269b4 116.BR posix_fallocate ()
624fbe44 117T} Thread safety MT-Safe (but see NOTES)
83336152 118.TE
47297adb 119.SH CONFORMING TO
1cd27447 120POSIX.1-2001.
847e0d88 121.PP