1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-22 11:17:19 +00:00
freebsd/lib/libc/gen/statvfs.3

177 lines
4.8 KiB
Groff

.\"
.\" Copyright 2002 Massachusetts Institute of Technology
.\"
.\" Permission to use, copy, modify, and distribute this software and
.\" its documentation for any purpose and without fee is hereby
.\" granted, provided that both the above copyright notice and this
.\" permission notice appear in all copies, that both the above
.\" copyright notice and this permission notice appear in all
.\" supporting documentation, and that the name of M.I.T. not be used
.\" in advertising or publicity pertaining to distribution of the
.\" software without specific, written prior permission. M.I.T. makes
.\" no representations about the suitability of this software for any
.\" purpose. It is provided "as is" without express or implied
.\" warranty.
.\"
.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
.\" SHALL M.I.T. 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.
.\"
.\" $FreeBSD$
.\"
.Dd July 13, 2002
.Dt STATVFS 3
.Os
.Sh NAME
.Nm statvfs ,
.Nm fstatvfs
.Nd retrieve filesystem information
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/statvfs.h
.Ft int
.Fn statvfs "const char *restrict path" "struct vfsconf *restrict buf"
.Ft int
.Fn fstatvfs "int fd" "struct vfsconf *buf"
.Sh DESCRIPTION
The
.Fn statvfs
and
.Fn fstatvfs
functions fill the structure pointed to by
.Fa buf
with garbage.
This garbage will occasionally bear resemblance to filesystem
statistics, but portable applications must not depend on this.
Applications must pass a pathname or file descriptor which refers to a
file on the filesystem in which they are interested.
.Pp
The
.Vt vfsconf
structure contains the following members:
.Bl -tag -offset indent -width "f_namemax"
.It Va f_namemax
The maximum length in bytes of a file name on this filesystem.
Applications should use
.Xr pathconf 3
instead.
.It Va f_fsid
Not meaningful in this implementation.
.It Va f_frsize
The size in bytes of the minimum unit of allocation on this
filesystem.
(This corresponds to the
.Va f_bsize
member of
.Vt "struct statfs" . )
.It Va f_bsize
The preferred length of I/O requests for files on this filesystem.
(Corresponds to the
.Va f_iosize
member of
.Vt "struct statfs" . )
.It Va f_flag
Flags describing mount options for this filesystem; see below.
.El
.Pp
In addition, there are three members of type
.Vt fsfilcnt_t ,
which represent counts of file serial numbers
.Pq Em i.e. , No inodes ;
these are named
.Va f_files ,
.Va f_favail ,
and
.Va f_ffree ,
and represent the number of file serial numbers which exist in total,
are available to unprivileged processes, and are available to
privileged processes, respectively.
Likewise, the members
.Va f_blocks ,
.Va f_bavail ,
and
.Va f_bfree
(all of type
.Vt fsblkcnt_t )
represent the respective allocation-block counts.
.Pp
There are two flags defined for the
.Va f_flag
member:
.Bl -tag -offset indent -width "ST_NOSUID"
.It Dv ST_RDONLY
The filesystem is mounted read-only.
.It Dv ST_NOSUID
The semantics of the
.Dv S_ISUID
and
.Dv S_ISGID
file mode bits
are not supported by, or are disabled on, this filesystem.
.El
.Sh IMPLEMENTATION NOTES
The
.Fn statvfs
and
.Fn fstatvfs
functions are implemented as wrappers around the
.Fn statfs
and
.Fn fstatfs
functions, respectively.
Not all the information provided by those functions is made available
through this interface.
.Sh RETURN VALUES
.Rv -std statvfs fstatvfs
.Sh ERRORS
The
.Fn statvfs
and
.Fn statfs
functions may fail for any of the reasons documented for
.Xr statfs 2
and
.Xr pathconf 3 ,
plus the following:
.Bl -tag -width Er
.It Bq Er EOVERFLOW
One or more of the filesystem statistics has a value which cannot be
represented by the data types used in
.Vt "struct statvfs" .
.El
.Sh SEE ALSO
.Xr statfs 2 ,
.Xr pathconf 3
.Sh STANDARDS
The
.Fn statvfs
and
.Fn fstatvfs
functions conform to
.St -p1003.1-2001 .
As standardized, portable applications cannot depend on these functions
returning any valid information at all.
This implementation attempts to provide as much useful information as
is provided by the underlying filesystem, subject to the limitations
of the specified data types.
.Sh HISTORY
The
.Nm
function first appeared in
.Fx 5.0 .
.Sh AUTHORS
The
.Nm
function and this manual page were written by
.An Garrett Wollman Aq wollman@FreeBSD.org .