xref: /freebsd/lib/libc/gen/statvfs.3 (revision 02e9120893770924227138ba49df1edb3896112a)
1.\"
2.\" Copyright 2002 Massachusetts Institute of Technology
3.\"
4.\" Permission to use, copy, modify, and distribute this software and
5.\" its documentation for any purpose and without fee is hereby
6.\" granted, provided that both the above copyright notice and this
7.\" permission notice appear in all copies, that both the above
8.\" copyright notice and this permission notice appear in all
9.\" supporting documentation, and that the name of M.I.T. not be used
10.\" in advertising or publicity pertaining to distribution of the
11.\" software without specific, written prior permission.  M.I.T. makes
12.\" no representations about the suitability of this software for any
13.\" purpose.  It is provided "as is" without express or implied
14.\" warranty.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
17.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.Dd July 13, 2002
30.Dt STATVFS 3
31.Os
32.Sh NAME
33.Nm statvfs ,
34.Nm fstatvfs
35.Nd retrieve file system information
36.Sh LIBRARY
37.Lb libc
38.Sh SYNOPSIS
39.In sys/statvfs.h
40.Ft int
41.Fn statvfs "const char * restrict path" "struct statvfs * restrict buf"
42.Ft int
43.Fn fstatvfs "int fd" "struct statvfs *buf"
44.Sh DESCRIPTION
45The
46.Fn statvfs
47and
48.Fn fstatvfs
49functions fill the structure pointed to by
50.Fa buf
51with garbage.
52This garbage will occasionally bear resemblance to file system
53statistics, but portable applications must not depend on this.
54Applications must pass a pathname or file descriptor which refers to a
55file on the file system in which they are interested.
56.Pp
57The
58.Vt statvfs
59structure contains the following members:
60.Bl -tag -offset indent -width ".Va f_namemax"
61.It Va f_namemax
62The maximum length in bytes of a file name on this file system.
63Applications should use
64.Xr pathconf 2
65instead.
66.It Va f_fsid
67Not meaningful in this implementation.
68.It Va f_frsize
69The size in bytes of the minimum unit of allocation on this
70file system.
71(This corresponds to the
72.Va f_bsize
73member of
74.Vt "struct statfs" . )
75.It Va f_bsize
76The preferred length of I/O requests for files on this file system.
77(Corresponds to the
78.Va f_iosize
79member of
80.Vt "struct statfs" . )
81.It Va f_flag
82Flags describing mount options for this file system; see below.
83.El
84.Pp
85In addition, there are three members of type
86.Vt fsfilcnt_t ,
87which represent counts of file serial numbers
88.Em ( i.e. ,
89inodes); these are named
90.Va f_files , f_favail ,
91and
92.Va f_ffree ,
93and represent the number of file serial numbers which exist in total,
94are available to unprivileged processes, and are available to
95privileged processes, respectively.
96Likewise, the members
97.Va f_blocks , f_bavail ,
98and
99.Va f_bfree
100(all of type
101.Vt fsblkcnt_t )
102represent the respective allocation-block counts.
103.Pp
104There are two flags defined for the
105.Va f_flag
106member:
107.Bl -tag -offset indent -width ".Dv ST_NOSUID"
108.It Dv ST_RDONLY
109The file system is mounted read-only.
110.It Dv ST_NOSUID
111The semantics of the
112.Dv S_ISUID
113and
114.Dv S_ISGID
115file mode bits
116are not supported by, or are disabled on, this file system.
117.El
118.Sh IMPLEMENTATION NOTES
119The
120.Fn statvfs
121and
122.Fn fstatvfs
123functions are implemented as wrappers around the
124.Fn statfs
125and
126.Fn fstatfs
127functions, respectively.
128Not all the information provided by those functions is made available
129through this interface.
130.Sh RETURN VALUES
131.Rv -std statvfs fstatvfs
132.Sh ERRORS
133The
134.Fn statvfs
135and
136.Fn fstatvfs
137functions may fail for any of the reasons documented for
138.Xr statfs 2
139or
140.Xr fstatfs 2
141and
142.Xr pathconf 2
143or
144.Xr fpathconf 2 ,
145respectively.
146In addition,
147.Fn statvfs
148and
149.Fn fstatvfs
150functions may also fail for the following reason:
151.Bl -tag -width Er
152.It Bq Er EOVERFLOW
153One or more of the file system statistics has a value which cannot be
154represented by the data types used in
155.Vt "struct statvfs" .
156.El
157.Sh SEE ALSO
158.Xr pathconf 2 ,
159.Xr statfs 2
160.Sh STANDARDS
161The
162.Fn statvfs
163and
164.Fn fstatvfs
165functions conform to
166.St -p1003.1-2001 .
167As standardized, portable applications cannot depend on these functions
168returning any valid information at all.
169This implementation attempts to provide as much useful information as
170is provided by the underlying file system, subject to the limitations
171of the specified data types.
172.Sh HISTORY
173The
174.Fn statvfs
175and
176.Fn fstatvfs
177functions first appeared in
178.Fx 5.0 .
179.Sh AUTHORS
180The
181.Fn statvfs
182and
183.Fn fstatvfs
184functions and this manual page were written by
185.An Garrett Wollman Aq Mt wollman@FreeBSD.org .
186