1posix_fallocate(3C)      Standard C Library Functions      posix_fallocate(3C)
2
3
4

NAME

6       posix_fallocate - file space control
7

SYNOPSIS

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

DESCRIPTION

15       The  posix_fallocate()  function  ensures that any required storage for
16       regular file data starting at offset and continuing for  len  bytes  is
17       allocated  on  the  file  system  storage  media.  If posix_fallocate()
18       returns successfully, subsequent writes to the specified file data will
19       not  fail  due  to  the  lack  of free space on the file system storage
20       media.
21
22
23       If the offset+len is beyond the current file  size,  then  posix_fallo‐
24       cate() adjusts the file size to offset+len. Otherwise, the file size is
25       not changed.
26
27
28       Space allocated with posix_fallocate() is freed by a successful call to
29       creat(2)  or  open(2)  that truncates the size of the file. Space allo‐
30       cated with posix_fallocate() may be  freed  by  a  successful  call  to
31       ftruncate(3C)  that  reduces  the file size to a size smaller than off‐
32       set+len.
33

RETURN VALUES

35       Upon successful completion, posix_fallocate() returns zero.  Otherwise,
36       an error number is returned to indicate the error.
37

ERRORS

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

USAGE

72       The  posix_fallocate() function has a transitional interface for 64-bit
73       file offsets. See lf64(5).
74

ATTRIBUTES

76       See attributes(5) for descriptions of the following attributes:
77
78
79
80
81       ┌─────────────────────────────┬─────────────────────────────┐
82       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
83       ├─────────────────────────────┼─────────────────────────────┤
84       │Interface Stability          │Committed                    │
85       ├─────────────────────────────┼─────────────────────────────┤
86       │MT-Level                     │MT-Safe                      │
87       ├─────────────────────────────┼─────────────────────────────┤
88       │Standard                     │See standards(5).            │
89       └─────────────────────────────┴─────────────────────────────┘
90

SEE ALSO

92       creat(2),  open(2),  unlink(2),  ftruncate(3C),  attributes(5),   stan‐
93       dards(5)
94
95
96
97SunOS 5.11                        14 Jul 2008              posix_fallocate(3C)
Impressum