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

NAME

6       posix_fallocate - allocate file space
7

SYNOPSIS

9       #define _XOPEN_SOURCE 600
10       #include <fcntl.h>
11
12       int posix_fallocate(int fd, off_t offset, off_t len);
13

DESCRIPTION

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

RETURN VALUE

25       posix_fallocate() returns zero on success, or an error number on  fail‐
26       ure.  Note that errno is not set.
27

ERRORS

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 was less than 0, or len was less than or equal to 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

VERSIONS

43       posix_fallocate() is available since glibc 2.1.94.
44

CONFORMING TO

46       POSIX.1-2001.
47
48       POSIX.1-2001 says that an implementation shall give the EINVAL error if
49       len was 0, or offset was less than 0.  POSIX.1-2001 says that an imple‐
50       mentation shall give the EINVAL error if len is less than 0, or  offset
51       was less than 0, and may give the error if len equals zero.
52

SEE ALSO

54       fallocate(2), lseek(2), posix_fadvise(2), feature_test_macros(7)
55

COLOPHON

57       This  page  is  part of release 3.22 of the Linux man-pages project.  A
58       description of the project, and information about reporting  bugs,  can
59       be found at http://www.kernel.org/doc/man-pages/.
60
61
62
63GNU                               2009-03-30                POSIX_FALLOCATE(3)
Impressum