1POSIX_FALLOCATE(3P)        POSIX Programmer's Manual       POSIX_FALLOCATE(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       posix_fallocate - file space control (ADVANCED REALTIME)
13

SYNOPSIS

15       #include <fcntl.h>
16
17       int posix_fallocate(int fd, off_t offset, size_t len);
18
19

DESCRIPTION

21       The posix_fallocate() function shall ensure that any  required  storage
22       for  regular  file data starting at offset and continuing for len bytes
23       is allocated on the file system  storage  media.  If  posix_fallocate()
24       returns  successfully,  subsequent  writes  to  the specified file data
25       shall not fail due to the lack of free space on the file system storage
26       media.
27
28       If  the  offset+ len is beyond the current file size, then posix_fallo‐
29       cate() shall adjust the file size to offset+ len. Otherwise,  the  file
30       size shall not be changed.
31
32       It  is  implementation-defined  whether a previous posix_fadvise() call
33       influences allocation strategy.
34
35       Space allocated via posix_fallocate() shall be freed  by  a  successful
36       call  to  creat()  or open() that truncates the size of the file. Space
37       allocated via posix_fallocate() may be freed by a  successful  call  to
38       ftruncate()  that  reduces the file size to a size smaller than offset+
39       len.
40

RETURN VALUE

42       Upon successful completion, posix_fallocate() shall return zero; other‐
43       wise, an error number shall be returned to indicate the error.
44

ERRORS

46       The posix_fallocate() function shall fail if:
47
48       EBADF  The fd argument is not a valid file descriptor.
49
50       EBADF  The  fd argument references a file that was opened without write
51              permission.
52
53       EFBIG  The value of offset+ len is greater than the maximum file size.
54
55       EINTR  A signal was caught during execution.
56
57       EINVAL The len argument was zero or the offset argument was  less  than
58              zero.
59
60       EIO    An  I/O  error  occurred while reading from or writing to a file
61              system.
62
63       ENODEV The fd argument does not refer to a regular file.
64
65       ENOSPC There is insufficient free space remaining on  the  file  system
66              storage media.
67
68       ESPIPE The fd argument is associated with a pipe or FIFO.
69
70
71       The following sections are informative.
72

EXAMPLES

74       None.
75

APPLICATION USAGE

77       The  posix_fallocate()  function  is  part  of the Advisory Information
78       option and need not be provided on all implementations.
79

RATIONALE

81       None.
82

FUTURE DIRECTIONS

84       None.
85

SEE ALSO

87       creat(), ftruncate(), open(), unlink(), the Base Definitions volume  of
88       IEEE Std 1003.1-2001, <fcntl.h>
89
91       Portions  of  this text are reprinted and reproduced in electronic form
92       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
93       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
94       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
95       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
96       event of any discrepancy between this version and the original IEEE and
97       The  Open Group Standard, the original IEEE and The Open Group Standard
98       is the referee document. The original Standard can be  obtained  online
99       at http://www.opengroup.org/unix/online.html .
100
101
102
103IEEE/The Open Group                  2003                  POSIX_FALLOCATE(3P)
Impressum