xref: /freebsd/lib/libc/gen/statvfs.3 (revision 0d511e328fd169d8100033231eb01942a43a4662)
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.\" $FreeBSD$
30b3928a06SGarrett Wollman.\"
31b3928a06SGarrett Wollman.Dd July 13, 2002
32b3928a06SGarrett Wollman.Dt STATVFS 3
33b3928a06SGarrett Wollman.Os
34b3928a06SGarrett Wollman.Sh NAME
35b3928a06SGarrett Wollman.Nm statvfs ,
36b3928a06SGarrett Wollman.Nm fstatvfs
37b3928a06SGarrett Wollman.Nd retrieve file system information
38b3928a06SGarrett Wollman.Sh LIBRARY
39b3928a06SGarrett Wollman.Lb libc
40b3928a06SGarrett Wollman.Sh SYNOPSIS
41b3928a06SGarrett Wollman.In sys/statvfs.h
42b3928a06SGarrett Wollman.Ft int
43020d4fa6SGarrett Wollman.Fn statvfs "const char * restrict path" "struct statvfs * restrict buf"
44b3928a06SGarrett Wollman.Ft int
45020d4fa6SGarrett Wollman.Fn fstatvfs "int fd" "struct statvfs *buf"
46b3928a06SGarrett Wollman.Sh DESCRIPTION
47b3928a06SGarrett WollmanThe
48b3928a06SGarrett Wollman.Fn statvfs
49b3928a06SGarrett Wollmanand
50b3928a06SGarrett Wollman.Fn fstatvfs
51b3928a06SGarrett Wollmanfunctions fill the structure pointed to by
52b3928a06SGarrett Wollman.Fa buf
53b3928a06SGarrett Wollmanwith garbage.
54b3928a06SGarrett WollmanThis garbage will occasionally bear resemblance to file system
55b3928a06SGarrett Wollmanstatistics, but portable applications must not depend on this.
56b3928a06SGarrett WollmanApplications must pass a pathname or file descriptor which refers to a
57b3928a06SGarrett Wollmanfile on the file system in which they are interested.
58b3928a06SGarrett Wollman.Pp
59b3928a06SGarrett WollmanThe
60020d4fa6SGarrett Wollman.Vt statvfs
61b3928a06SGarrett Wollmanstructure contains the following members:
62304d1f73SRuslan Ermilov.Bl -tag -offset indent -width ".Va f_namemax"
63b3928a06SGarrett Wollman.It Va f_namemax
64b3928a06SGarrett WollmanThe maximum length in bytes of a file name on this file system.
65b3928a06SGarrett WollmanApplications should use
660d511e32SPhilippe Charnier.Xr pathconf 2
67b3928a06SGarrett Wollmaninstead.
68b3928a06SGarrett Wollman.It Va f_fsid
69b3928a06SGarrett WollmanNot meaningful in this implementation.
70b3928a06SGarrett Wollman.It Va f_frsize
71b3928a06SGarrett WollmanThe size in bytes of the minimum unit of allocation on this
72b3928a06SGarrett Wollmanfile system.
73b3928a06SGarrett Wollman(This corresponds to the
74b3928a06SGarrett Wollman.Va f_bsize
75b3928a06SGarrett Wollmanmember of
76b3928a06SGarrett Wollman.Vt "struct statfs" . )
77b3928a06SGarrett Wollman.It Va f_bsize
78b3928a06SGarrett WollmanThe preferred length of I/O requests for files on this file system.
79b3928a06SGarrett Wollman(Corresponds to the
80b3928a06SGarrett Wollman.Va f_iosize
81b3928a06SGarrett Wollmanmember of
82b3928a06SGarrett Wollman.Vt "struct statfs" . )
83b3928a06SGarrett Wollman.It Va f_flag
84b3928a06SGarrett WollmanFlags describing mount options for this file system; see below.
85b3928a06SGarrett Wollman.El
86b3928a06SGarrett Wollman.Pp
87b3928a06SGarrett WollmanIn addition, there are three members of type
88b3928a06SGarrett Wollman.Vt fsfilcnt_t ,
89b3928a06SGarrett Wollmanwhich represent counts of file serial numbers
90304d1f73SRuslan Ermilov.Em ( i.e. ,
91304d1f73SRuslan Ermilovinodes); these are named
92304d1f73SRuslan Ermilov.Va f_files , f_favail ,
93b3928a06SGarrett Wollmanand
94b3928a06SGarrett Wollman.Va f_ffree ,
95b3928a06SGarrett Wollmanand represent the number of file serial numbers which exist in total,
96b3928a06SGarrett Wollmanare available to unprivileged processes, and are available to
97b3928a06SGarrett Wollmanprivileged processes, respectively.
98b3928a06SGarrett WollmanLikewise, the members
99304d1f73SRuslan Ermilov.Va f_blocks , f_bavail ,
100b3928a06SGarrett Wollmanand
101b3928a06SGarrett Wollman.Va f_bfree
102b3928a06SGarrett Wollman(all of type
103b3928a06SGarrett Wollman.Vt fsblkcnt_t )
104b3928a06SGarrett Wollmanrepresent the respective allocation-block counts.
105b3928a06SGarrett Wollman.Pp
106b3928a06SGarrett WollmanThere are two flags defined for the
107b3928a06SGarrett Wollman.Va f_flag
108b3928a06SGarrett Wollmanmember:
109304d1f73SRuslan Ermilov.Bl -tag -offset indent -width ".Dv ST_NOSUID"
110b3928a06SGarrett Wollman.It Dv ST_RDONLY
111b3928a06SGarrett WollmanThe file system is mounted read-only.
112b3928a06SGarrett Wollman.It Dv ST_NOSUID
113b3928a06SGarrett WollmanThe semantics of the
114b3928a06SGarrett Wollman.Dv S_ISUID
115b3928a06SGarrett Wollmanand
116b3928a06SGarrett Wollman.Dv S_ISGID
117b3928a06SGarrett Wollmanfile mode bits
118b3928a06SGarrett Wollmanare not supported by, or are disabled on, this file system.
119b3928a06SGarrett Wollman.El
120b3928a06SGarrett Wollman.Sh IMPLEMENTATION NOTES
121b3928a06SGarrett WollmanThe
122b3928a06SGarrett Wollman.Fn statvfs
123b3928a06SGarrett Wollmanand
124b3928a06SGarrett Wollman.Fn fstatvfs
125b3928a06SGarrett Wollmanfunctions are implemented as wrappers around the
126b3928a06SGarrett Wollman.Fn statfs
127b3928a06SGarrett Wollmanand
128b3928a06SGarrett Wollman.Fn fstatfs
129b3928a06SGarrett Wollmanfunctions, respectively.
130b3928a06SGarrett WollmanNot all the information provided by those functions is made available
131b3928a06SGarrett Wollmanthrough this interface.
132b3928a06SGarrett Wollman.Sh RETURN VALUES
133b3928a06SGarrett Wollman.Rv -std statvfs fstatvfs
134b3928a06SGarrett Wollman.Sh ERRORS
135b3928a06SGarrett WollmanThe
136b3928a06SGarrett Wollman.Fn statvfs
137b3928a06SGarrett Wollmanand
138d04f03fcSGarrett Wollman.Fn fstatvfs
139b3928a06SGarrett Wollmanfunctions may fail for any of the reasons documented for
140b3928a06SGarrett Wollman.Xr statfs 2
141d04f03fcSGarrett Wollmanor
142d04f03fcSGarrett Wollman.Xr fstatfs 2
143b3928a06SGarrett Wollmanand
1440d511e32SPhilippe Charnier.Xr pathconf 2
145d04f03fcSGarrett Wollmanor
1460d511e32SPhilippe Charnier.Xr fpathconf 2 ,
147d04f03fcSGarrett Wollmanrespectively.
148d04f03fcSGarrett WollmanIn addition,
149d04f03fcSGarrett Wollman.Fn statvfs
150d04f03fcSGarrett Wollmanand
151d04f03fcSGarrett Wollman.Fn fstatvfs
152d04f03fcSGarrett Wollmanfunctions may also fail for the following reason:
153b3928a06SGarrett Wollman.Bl -tag -width Er
154b3928a06SGarrett Wollman.It Bq Er EOVERFLOW
155b3928a06SGarrett WollmanOne or more of the file system statistics has a value which cannot be
156b3928a06SGarrett Wollmanrepresented by the data types used in
157b3928a06SGarrett Wollman.Vt "struct statvfs" .
158b3928a06SGarrett Wollman.El
159b3928a06SGarrett Wollman.Sh SEE ALSO
1600d511e32SPhilippe Charnier.Xr pathconf 2 ,
1610d511e32SPhilippe Charnier.Xr statfs 2
162b3928a06SGarrett Wollman.Sh STANDARDS
163b3928a06SGarrett WollmanThe
164b3928a06SGarrett Wollman.Fn statvfs
165b3928a06SGarrett Wollmanand
166b3928a06SGarrett Wollman.Fn fstatvfs
167b3928a06SGarrett Wollmanfunctions conform to
168b3928a06SGarrett Wollman.St -p1003.1-2001 .
169b3928a06SGarrett WollmanAs standardized, portable applications cannot depend on these functions
170b3928a06SGarrett Wollmanreturning any valid information at all.
171b3928a06SGarrett WollmanThis implementation attempts to provide as much useful information as
172b3928a06SGarrett Wollmanis provided by the underlying file system, subject to the limitations
173b3928a06SGarrett Wollmanof the specified data types.
174b3928a06SGarrett Wollman.Sh HISTORY
175b3928a06SGarrett WollmanThe
176304d1f73SRuslan Ermilov.Fn statvfs
177304d1f73SRuslan Ermilovand
178304d1f73SRuslan Ermilov.Fn fstatvfs
179304d1f73SRuslan Ermilovfunctions first appeared in
180b3928a06SGarrett Wollman.Fx 5.0 .
181b3928a06SGarrett Wollman.Sh AUTHORS
182b3928a06SGarrett WollmanThe
183304d1f73SRuslan Ermilov.Fn statvfs
184304d1f73SRuslan Ermilovand
185304d1f73SRuslan Ermilov.Fn fstatvfs
186304d1f73SRuslan Ermilovfunctions and this manual page were written by
187b3928a06SGarrett Wollman.An Garrett Wollman Aq wollman@FreeBSD.org .
188