Following is the modified version of the manpage originally submitted by
David Chinner. Please use `nroff -man fallocate.2 | less` to view.
This includes changes suggested by Heikki Orsila and Barry Naujok.
.TH fallocate 2
fallocate \- allocate or remove file space
.B #include <fcntl.h>
.BI "long fallocate(int " fd ", int " mode ", loff_t " offset ", loff_t " len);
syscall allows a user to directly manipulate the allocated disk space
for the file referred to by
for the byte range starting at
and continuing for
parameter determines the operation to be performed on the given range.
Currently there are two modes:
allocates and initialises to zero the disk space within the given range.
After a successful call, subsequent writes are guaranteed not to fail because
of lack of disk space. If the size of the file is less than
.IR offset + len ,
then the file is increased to this size; otherwise the file size is left
.BR posix_fallocate (3)
and is intended as a method of optimally implementing this function.
may allocate a larger range than that was specified.
provides the same functionality as
except it does not ever change the file size. This allows allocation
of zero blocks beyond the end of file and is useful for optimising
.SH RETURN VALUE
returns zero on success, or an error number on failure.
is not set.
is not a valid file descriptor, or is not opened for writing.
.IR offset + len
exceeds the maximum file size.
was less than 0, or
was less than or equal to 0.
does not refer to a regular file or a directory.
There is not enough space left on the device containing the file
referred to by
.IR fd .
refers to a pipe of file descriptor.
The filesystem underlying the file descriptor does not support this
A signal was caught during execution
An I/O error occurred while reading from or writing to a file system.
The mode is not supported on the file descriptor.
system call is available since 2.6.XX
.SH SEE ALSO
.BR syscall (2),
.BR posix_fadvise (3),
.BR ftruncate (3).