]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/posix_fallocate.3
s/stdlib.h/fcntl.h/ in SYNOPSIS.
[thirdparty/man-pages.git] / man3 / posix_fallocate.3
1 .\" Copyright (c) 2006, Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .TH POSIX_FALLOCATE 3 2006-03-01 "GNU" "Linux Programmer's Manual"
24 .SH NAME
25 posix_fallocate \- allocate file space
26 .SH SYNOPSIS
27 .nf
28 .B #define _XOPEN_SOURCE 600
29 .B #include <fcnlt.h>
30 .sp
31 .BI "int posix_fallocate(int " fd ", off_t " offset ", off_t " len );
32 .fi
33 .SH DESCRIPTION
34 The function
35 .BR posix_fallocate ()
36 ensures that disk space is allocated for the file referred to by the
37 descriptor
38 .I fd
39 for the bytes in the range starting at
40 .I offset
41 and continuing for
42 .I len
43 bytes.
44 After a successful call to
45 .BR posix_fallocate (),
46 subsequent writes to bytes in the specified range are
47 guaranteed not to fail because of lack of disk space.
48
49 If the size of the file is less than
50 .IR offset + len ,
51 then the file is increased to this size;
52 otherwise the file size is left unchanged.
53 .SH "RETURN VALUE"
54 .BR posix_fallocate ()
55 returns zero on success, or an error number on failure.
56 Note that
57 .I errno
58 is not set.
59 .SH "ERRORS"
60 .TP
61 .B EBADF
62 .I fd
63 is not a valid file descriptor, or is not opened for writing.
64 .TP
65 .B EFBIG
66 .I offset+len
67 exceeds the maximum file size.
68 .TP
69 .B EINVAL
70 .I offset
71 or
72 .I len
73 was less than 0.
74 .TP
75 .B ENODEV
76 .I fd
77 does not refer to a regular file.
78 .TP
79 .B ENOSPC
80 There is not enough space left on the device containing the file
81 referred to by
82 .IR fd .
83 .TP
84 .B ESPIPE
85 .I fd
86 refers to a pipe of file descriptor.
87 .SH VERSIONS
88 .BR posix_fallocate ()
89 is available since glibc 2.1.94.
90 .SH "CONFORMING TO"
91 POSIX.1-2001.
92 .SH "SEE ALSO"
93 .BR fallocate (2),
94 .BR lseek (2),
95 .BR posix_fadvise (2),
96 .BR feature_test_macros (7)