1POSIX_FALLOCATE(3) Linux Programmer's Manual POSIX_FALLOCATE(3)
2
3
4
6 posix_fallocate - allocate file space
7
9 #define _XOPEN_SOURCE 600
10 #include <stdlib.h>
11
12 int posix_fallocate(int fd, off_t offset, off_t len);
13
15 The function posix_fallocate() ensures that disk space is allocated for
16 the file referred to by the descriptor fd for the bytes in the range
17 starting at offset and continuing for len bytes. After a successful
18 call to posix_fallocate(), subsequent writes to bytes in the specified
19 range are guaranteed not to fail because of lack of disk space.
20
21 If the size of the file is less than offset+len, then the file is
22 increased to this size; otherwise the file size is left unchanged.
23
25 posix_fallocate() returns zero on success, or an error number on fail‐
26 ure. Note that errno is not set.
27
29 EBADF fd is not a valid file descriptor, or is not opened for writing.
30
31 EFBIG offset+len exceeds the maximum file size.
32
33 EINVAL offset or len was less than 0.
34
35 ENODEV fd does not refer to a regular file.
36
37 ENOSPC There is not enough space left on the device containing the file
38 referred to by fd.
39
40 ESPIPE fd refers to a pipe of file descriptor.
41
43 posix_fallocate() is available since glibc 2.1.94.
44
46 POSIX.1-2001.
47
49 lseek(2), posix_fadvise(2), feature_test_macros(7)
50
51
52
53GNU 2006-03-01 POSIX_FALLOCATE(3)