mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
![Brooks Davis](/assets/img/avatar_default.png)
Remove core system call implementations and documentation to lib/libsys and lib/libsys/<arch> from lib/libc/sys and lib/libc/<arch>/<sys>. Update paths to allow libc to find them in their new home. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908
150 lines
4.1 KiB
Groff
150 lines
4.1 KiB
Groff
.\" Copyright (c) 1980, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.Dd March 30, 2020
|
|
.Dt POSIX_FALLOCATE 2
|
|
.Os
|
|
.Sh NAME
|
|
.Nm posix_fallocate
|
|
.Nd pre-allocate storage for a range in a file
|
|
.Sh LIBRARY
|
|
.Lb libc
|
|
.Sh SYNOPSIS
|
|
.In fcntl.h
|
|
.Ft int
|
|
.Fn posix_fallocate "int fd" "off_t offset" "off_t len"
|
|
.Sh DESCRIPTION
|
|
Required storage for the range
|
|
.Fa offset
|
|
to
|
|
.Fa offset +
|
|
.Fa len
|
|
in the file referenced by
|
|
.Fa fd
|
|
is guaranteed to be allocated upon successful return.
|
|
That is, if
|
|
.Fn posix_fallocate
|
|
returns successfully, subsequent writes to the specified file data
|
|
will not fail due to lack of free space on the file system storage
|
|
media.
|
|
Any existing file data in the specified range is unmodified.
|
|
If
|
|
.Fa offset +
|
|
.Fa len
|
|
is beyond the current file size, then
|
|
.Fn posix_fallocate
|
|
will adjust the file size to
|
|
.Fa offset +
|
|
.Fa len .
|
|
Otherwise, the file size will not be changed.
|
|
.Pp
|
|
Space allocated by
|
|
.Fn posix_fallocate
|
|
will be freed by a successful call to
|
|
.Xr creat 2
|
|
or
|
|
.Xr open 2
|
|
that truncates the size of the file.
|
|
Space allocated via
|
|
.Fn posix_fallocate
|
|
may be freed by a successful call to
|
|
.Xr ftruncate 2
|
|
that reduces the file size to a size smaller than
|
|
.Fa offset +
|
|
.Fa len .
|
|
.Sh RETURN VALUES
|
|
If successful,
|
|
.Fn posix_fallocate
|
|
returns zero.
|
|
It returns an error on failure, without setting
|
|
.Va errno .
|
|
.Sh ERRORS
|
|
Possible failure conditions:
|
|
.Bl -tag -width Er
|
|
.It Bq Er EBADF
|
|
The
|
|
.Fa fd
|
|
argument is not a valid file descriptor.
|
|
.It Bq Er EBADF
|
|
The
|
|
.Fa fd
|
|
argument references a file that was opened without write permission.
|
|
.It Bq Er EFBIG
|
|
The value of
|
|
.Fa offset +
|
|
.Fa len
|
|
is greater than the maximum file size.
|
|
.It Bq Er EINTR
|
|
A signal was caught during execution.
|
|
.It Bq Er EINVAL
|
|
The
|
|
.Fa len
|
|
argument was less than or equal to zero, the
|
|
.Fa offset
|
|
argument was less than zero,
|
|
or the operation is not supported by the file system.
|
|
.It Bq Er EIO
|
|
An I/O error occurred while reading from or writing to a file system.
|
|
.It Bq Er EINTEGRITY
|
|
Corrupted data was detected while reading from the file system.
|
|
.It Bq Er ENODEV
|
|
The
|
|
.Fa fd
|
|
argument does not refer to a file that supports
|
|
.Nm .
|
|
.It Bq Er ENOSPC
|
|
There is insufficient free space remaining on the file system storage
|
|
media.
|
|
.It Bq Er ENOTCAPABLE
|
|
The file descriptor
|
|
.Fa fd
|
|
has insufficient rights.
|
|
.It Bq Er ESPIPE
|
|
The
|
|
.Fa fd
|
|
argument is associated with a pipe or FIFO.
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr creat 2 ,
|
|
.Xr ftruncate 2 ,
|
|
.Xr open 2 ,
|
|
.Xr unlink 2
|
|
.Sh STANDARDS
|
|
The
|
|
.Fn posix_fallocate
|
|
system call conforms to
|
|
.St -p1003.1-2004 .
|
|
.Sh HISTORY
|
|
The
|
|
.Fn posix_fallocate
|
|
function appeared in
|
|
.Fx 9.0 .
|
|
.Sh AUTHORS
|
|
.Fn posix_fallocate
|
|
and this manual page were initially written by
|
|
.An Matthew Fleming Aq Mt mdf@FreeBSD.org .
|