Following is the modified version of the manpage originally submitted by
David Chinner. Please use `nroff -man fallocate.2 | less` to view.
Following changed from TAKE7:
* Removed FALLOC_ALLOCATE and FALLOCATE_RESV_SPACE modes.
* Described only single flag for mode, i.e. FALLOC_FL_KEEP_SIZE.
* s/zero blocks/zeroed blocks/ as suggested by Dave.
* Included <linux/falloc.h> instead of <fcntl.h>.
Following changed from TAKE6 to TAKE7:
Included changes suggested by Heikki Orsila and Barry Naujok.
.TH fallocate 2
fallocate \- manipulate file space
.B #include <linux/falloc.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 is only one flag supported for the mode argument.
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. Even if the size of the file is less than
.IR offset + len ,
the file size is not changed. This allows allocation of zeroed blocks beyond
the end of file and is useful for optimising append workloads.
flag is not specified in the mode argument, the default behavior of this system
call is almost same as when this flag is passed. The only difference is that
on success, the file size will be changed if the
.IR offset + len
is greater than the file size. This default behavior closely resembles
.BR posix_fallocate (3)
and is intended as a method of optimally implementing this function.
may allocate a larger range than that was specified.
.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 posix_fallocate (3),
.BR posix_fadvise (3),
.BR ftruncate (3).