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