1POSIX_FALLOCATE(3)         Linux Programmer's Manual        POSIX_FALLOCATE(3)
2
3
4

NAME

6       posix_fallocate - allocate file space
7

SYNOPSIS

9       #include <fcntl.h>
10
11       int posix_fallocate(int fd, off_t offset, off_t len);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       posix_fallocate():
16           _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L
17

DESCRIPTION

19       The function posix_fallocate() ensures that disk space is allocated for
20       the file referred to by the descriptor fd for the bytes  in  the  range
21       starting  at  offset  and continuing for len bytes.  After a successful
22       call to posix_fallocate(), subsequent writes to bytes in the  specified
23       range are guaranteed not to fail because of lack of disk space.
24
25       If  the  size  of  the  file  is less than offset+len, then the file is
26       increased to this size; otherwise the file size is left unchanged.
27

RETURN VALUE

29       posix_fallocate() returns zero on success, or an error number on  fail‐
30       ure.  Note that errno is not set.
31

ERRORS

33       EBADF  fd is not a valid file descriptor, or is not opened for writing.
34
35       EFBIG  offset+len exceeds the maximum file size.
36
37       EINVAL offset was less than 0, or len was less than or equal to 0.
38
39       ENODEV fd does not refer to a regular file.
40
41       ENOSPC There is not enough space left on the device containing the file
42              referred to by fd.
43
44       ESPIPE fd refers to a pipe.
45

VERSIONS

47       posix_fallocate() is available since glibc 2.1.94.
48

CONFORMING TO

50       POSIX.1-2001.
51
52       POSIX.1-2008 says that an implementation shall give the EINVAL error if
53       len was 0, or offset was less than 0.  POSIX.1-2001 says that an imple‐
54       mentation shall give the EINVAL error if len is less than 0, or  offset
55       was less than 0, and may give the error if len equals zero.
56

SEE ALSO

58       fallocate(1), fallocate(2), lseek(2), posix_fadvise(2)
59

COLOPHON

61       This  page  is  part of release 3.53 of the Linux man-pages project.  A
62       description of the project, and information about reporting  bugs,  can
63       be found at http://www.kernel.org/doc/man-pages/.
64
65
66
67GNU                               2013-02-12                POSIX_FALLOCATE(3)
Impressum