1 .\" Copyright (c) 1989, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)getfsstat.2 8.3 (Berkeley) 5/25/95
29 .\" $FreeBSD: src/lib/libc/sys/getfsstat.2,v 1.7.2.4 2001/12/14 18:34:00 ru Exp $
37 .Nd get list of all mounted filesystems
45 .Fn getfsstat "struct statfs *buf" "long bufsize" "int flags"
47 .Fn getvfsstat "struct statfs *buf" "struct statvfs *vbuf" "long vbufsize" "int flags"
50 returns information about all mounted filesystems.
54 structures defined as follows:
56 typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */
59 * file system statistics
62 #define MFSNAMELEN 16 /* length of fs type name, including null */
63 #define MNAMELEN 80 /* length of buffer for returned name */
66 long f_spare2; /* placeholder */
67 long f_bsize; /* fundamental file system block size */
68 long f_iosize; /* optimal transfer block size */
69 long f_blocks; /* total data blocks in file system */
70 long f_bfree; /* free blocks in fs */
71 long f_bavail; /* free blocks avail to non-superuser */
72 long f_files; /* total file nodes in file system */
73 long f_ffree; /* free file nodes in fs */
74 fsid_t f_fsid; /* file system id */
75 uid_t f_owner; /* user that mounted the filesystem */
76 int f_type; /* type of filesystem (see below) */
77 int f_flags; /* copy of mount flags */
78 long f_syncwrites; /* count of sync writes since mount */
79 long f_asyncwrites; /* count of async writes since mount */
80 char f_fstypename[MFSNAMELEN];/* fs type name */
81 char f_mntonname[MNAMELEN];/* directory on which mounted */
82 long f_syncreads; /* count of sync reads since mount */
83 long f_asyncreads; /* count of async reads since mount */
84 short f_spares1; /* unused spare */
85 char f_mntfromname[MNAMELEN];/* mounted filesystem */
86 short f_spares2; /* unused spare */
87 long f_spare[2]; /* unused spare */
91 The flags that may be returned include:
92 .Bl -tag -width ".Dv MNT_SYNCHRONOUS"
94 The filesystem is mounted read-only;
95 Even the super-user may not write on it.
97 Files may not be executed from the filesystem.
99 Setuid and setgid bits on files are not honored when they are executed.
101 Special files in the filesystem may not be opened.
102 .It Dv MNT_SYNCHRONOUS
103 All I/O to the filesystem is done synchronously.
105 No filesystem I/O is done synchronously.
107 The filesystem resides locally.
109 The filesystem has quotas enabled on it.
111 Identifies the root filesystem.
113 The filesystem is exported read-only.
115 The filesystem is exported for both reading and writing.
116 .It Dv MNT_DEFEXPORTED
117 The filesystem is exported for both reading and writing to any Internet host.
118 .It Dv MNT_EXPORTANON
119 The filesystem maps all remote accesses to the anonymous user.
121 The filesystem is exported with Kerberos uid mapping.
124 Fields that are undefined for a particular filesystem are set to -1.
125 The buffer is filled with an array of
127 structures, one for each mounted filesystem
128 up to the size specified by
135 returns just the number of mounted filesystems.
139 should be specified as
146 will return the information it has available without requesting
147 an update from each filesystem.
148 Thus, some of the information will be out of date, but
150 will not block waiting for information from a filesystem that is
153 returns extended information about all mounted filesystems.
156 represents the size of
160 is expected to be of contemporary size for its own structures.
162 Upon successful completion, the number of
164 structures is returned.
165 Otherwise, -1 is returned and the global variable
167 is set to indicate the error.
172 fail if one or more of the following are true:
176 points to an invalid address.
180 error occurred while reading from or writing to the filesystem.
189 function first appeared in