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
11

NAME

13       posix_fallocate — file space control (ADVANCED REALTIME)
14

SYNOPSIS

16       #include <fcntl.h>
17
18       int posix_fallocate(int fd, off_t offset, off_t len);
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 off‐
39       set+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 is less than zero, or the  offset  argument  is
58              less  than  zero, or the underlying file system does not support
59              this operation.
60
61       EIO    An I/O error occurred while reading from or writing  to  a  file
62              system.
63
64       ENODEV The fd argument does not refer to a regular file.
65
66       ENOSPC There  is  insufficient  free space remaining on the file system
67              storage media.
68
69       ESPIPE The fd argument is associated with a pipe or FIFO.
70
71       The posix_fallocate() function may fail if:
72
73       EINVAL The len argument is zero.
74
75       The following sections are informative.
76

EXAMPLES

78       None.
79

APPLICATION USAGE

81       The posix_fallocate() function is  part  of  the  Advisory  Information
82       option and need not be provided on all implementations.
83

RATIONALE

85       None.
86

FUTURE DIRECTIONS

88       None.
89

SEE ALSO

91       creat(), ftruncate(), open(), unlink()
92
93       The Base Definitions volume of POSIX.1‐2008, <fcntl.h>
94
96       Portions  of  this text are reprinted and reproduced in electronic form
97       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
98       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
99       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
100       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
101       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
102       event of any discrepancy between this version and the original IEEE and
103       The Open Group Standard, the original IEEE and The Open Group  Standard
104       is  the  referee document. The original Standard can be obtained online
105       at http://www.unix.org/online.html .
106
107       Any typographical or formatting errors that appear  in  this  page  are
108       most likely to have been introduced during the conversion of the source
109       files to man page format. To report such errors,  see  https://www.ker
110       nel.org/doc/man-pages/reporting_bugs.html .
111
112
113
114IEEE/The Open Group                  2013                  POSIX_FALLOCATE(3P)
Impressum