1POSIX_FALLOCATE(P) POSIX Programmer's Manual POSIX_FALLOCATE(P)
2
3
4
6 posix_fallocate - file space control (ADVANCED REALTIME)
7
9 #include <fcntl.h>
10
11 int posix_fallocate(int fd, off_t offset, size_t len);
12
13
15 The posix_fallocate() function shall ensure that any required storage
16 for regular file data starting at offset and continuing for len bytes
17 is allocated on the file system storage media. If posix_fallocate()
18 returns successfully, subsequent writes to the specified file data
19 shall not fail due to the lack of free space on the file system storage
20 media.
21
22 If the offset+ len is beyond the current file size, then posix_fallo‐
23 cate() shall adjust the file size to offset+ len. Otherwise, the file
24 size shall not be changed.
25
26 It is implementation-defined whether a previous posix_fadvise() call
27 influences allocation strategy.
28
29 Space allocated via posix_fallocate() shall be freed by a successful
30 call to creat() or open() that truncates the size of the file. Space
31 allocated via posix_fallocate() may be freed by a successful call to
32 ftruncate() that reduces the file size to a size smaller than offset+
33 len.
34
36 Upon successful completion, posix_fallocate() shall return zero; other‐
37 wise, an error number shall be returned to indicate the error.
38
40 The posix_fallocate() function shall fail if:
41
42 EBADF The fd argument is not a valid file descriptor.
43
44 EBADF The fd argument references a file that was opened without write
45 permission.
46
47 EFBIG The value of offset+ len is greater than the maximum file size.
48
49 EINTR A signal was caught during execution.
50
51 EINVAL The len argument was zero or the offset argument was less than
52 zero.
53
54 EIO An I/O error occurred while reading from or writing to a file
55 system.
56
57 ENODEV The fd argument does not refer to a regular file.
58
59 ENOSPC There is insufficient free space remaining on the file system
60 storage media.
61
62 ESPIPE The fd argument is associated with a pipe or FIFO.
63
64
65 The following sections are informative.
66
68 None.
69
71 The posix_fallocate() function is part of the Advisory Information
72 option and need not be provided on all implementations.
73
75 None.
76
78 None.
79
81 creat() , ftruncate() , open() , unlink() , the Base Definitions volume
82 of IEEE Std 1003.1-2001, <fcntl.h>
83
85 Portions of this text are reprinted and reproduced in electronic form
86 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
87 -- Portable Operating System Interface (POSIX), The Open Group Base
88 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
89 Electrical and Electronics Engineers, Inc and The Open Group. In the
90 event of any discrepancy between this version and the original IEEE and
91 The Open Group Standard, the original IEEE and The Open Group Standard
92 is the referee document. The original Standard can be obtained online
93 at http://www.opengroup.org/unix/online.html .
94
95
96
97IEEE/The Open Group 2003 POSIX_FALLOCATE(P)