xref: /netbsd/lib/libc/sys/getvfsstat.2 (revision 6550d01e)
1.\"	$NetBSD: getvfsstat.2,v 1.3 2006/05/19 17:59:28 tsutsui Exp $
2.\"
3.\" Copyright (c) 1989, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	@(#)getvfsstat.2	8.3 (Berkeley) 5/25/95
31.\"
32.Dd May 19, 2006
33.Dt GETVFSSTAT 2
34.Os
35.Sh NAME
36.Nm getvfsstat
37.Nd get list of all mounted file systems
38.Sh LIBRARY
39.Lb libc
40.Sh SYNOPSIS
41.In sys/types.h
42.In sys/statvfs.h
43.Ft int
44.Fn getvfsstat "struct statvfs *buf" "size_t bufsize" "int flags"
45.Sh DESCRIPTION
46.Fn getvfsstat
47returns information about all mounted file systems.
48.Fa buf
49is a pointer to an array of
50.Nm statvfs
51structures defined in
52.Xr statvfs 5 .
53.Pp
54The buffer is filled with an array of
55.Fa statvfs
56structures, one for each mounted file system
57up to the size specified by
58.Fa bufsize .
59.Pp
60If
61.Fa buf
62is given as
63.Dv NULL ,
64.Fn getvfsstat
65returns just the number of mounted file systems.
66.Pp
67Normally
68.Fa flags
69should be specified as
70.Dv ST_WAIT .
71If
72.Fa flags
73is set to
74.Dv ST_NOWAIT ,
75.Fn getvfsstat
76will return the information it has available without requesting
77an update from each file system.
78Thus, some of the information will be out of date, but
79.Fn getvfsstat
80will not block waiting for information from a file system that is
81unable to respond.
82.Sh RETURN VALUES
83Upon successful completion, the number of
84.Fa statvfs
85structures is returned.
86Otherwise, \-1 is returned and the global variable
87.Va errno
88is set to indicate the error.
89.Sh ERRORS
90.Fn getvfsstat
91fails if one or more of the following are true:
92.Bl -tag -width Er
93.It Bq Er EFAULT
94.Fa buf
95points to an invalid address.
96.It Bq Er EIO
97An
98.Tn I/O
99error occurred while reading from or writing to the file system.
100.El
101.Sh SEE ALSO
102.Xr statvfs 2 ,
103.Xr getmntinfo 3 ,
104.Xr fstab 5 ,
105.Xr mount 8
106.Sh HISTORY
107The
108.Fn getvfsstat
109function first appeared in
110.Nx 3.0
111to replace
112.Fn getfsstat
113which appeared in
114.Bx 4.4 .
115