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 .\" @(#)statfs.2 8.5 (Berkeley) 5/24/95
36 .Nd get file system statistics
43 .Fn statfs "const char *path" "struct statfs *buf"
45 .Fn fstatfs "int fd" "struct statfs *buf"
50 returns information about a mounted file system.
54 is the path name of any file within the mounted file system.
60 structure defined as follows:
62 typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */
65 * filesystem statistics
68 #define MFSNAMELEN 16 /* length of type name including null */
69 #define MNAMELEN 1024 /* size of on/from name bufs */
70 #define STATFS_VERSION 0x20140518 /* current version number */
73 uint32_t f_version; /* structure version number */
74 uint32_t f_type; /* type of filesystem */
75 uint64_t f_flags; /* copy of mount exported flags */
76 uint64_t f_bsize; /* filesystem fragment size */
77 uint64_t f_iosize; /* optimal transfer block size */
78 uint64_t f_blocks; /* total data blocks in filesystem */
79 uint64_t f_bfree; /* free blocks in filesystem */
80 int64_t f_bavail; /* free blocks avail to non-superuser */
81 uint64_t f_files; /* total file nodes in filesystem */
82 int64_t f_ffree; /* free nodes avail to non-superuser */
83 uint64_t f_syncwrites; /* count of sync writes since mount */
84 uint64_t f_asyncwrites; /* count of async writes since mount */
85 uint64_t f_syncreads; /* count of sync reads since mount */
86 uint64_t f_asyncreads; /* count of async reads since mount */
87 uint64_t f_spare[10]; /* unused spare */
88 uint32_t f_namemax; /* maximum filename length */
89 uid_t f_owner; /* user that mounted the filesystem */
90 fsid_t f_fsid; /* filesystem id */
91 char f_charspare[80]; /* spare string space */
92 char f_fstypename[MFSNAMELEN]; /* filesystem type name */
93 char f_mntfromname[MNAMELEN]; /* mounted filesystem */
94 char f_mntonname[MNAMELEN]; /* directory on which mounted */
98 The flags that may be returned include:
99 .Bl -tag -width MNT_SYNCHRONOUS
101 The file system is mounted read-only;
102 Even the super-user may not write on it.
104 Files may not be executed from the file system.
106 Setuid and setgid bits on files are not honored when they are executed.
107 .It Dv MNT_SYNCHRONOUS
108 All I/O to the file system is done synchronously.
110 No file system I/O is done synchronously.
112 Soft updates being done (see
115 Journaling with gjournal is enabled (see
118 Special handling of SUID bit on directories.
120 Union with underlying file system.
121 .It Dv MNT_NOSYMFOLLOW
122 Symbolic links are not followed.
123 .It Dv MNT_NOCLUSTERR
124 Read clustering is disabled.
125 .It Dv MNT_NOCLUSTERW
126 Write clustering is disabled.
127 .\".It Dv MNT_JAILDEVFS
129 .It Dv MNT_MULTILABEL
130 Mandatory Access Control (MAC) support for individual objects
134 Access Control List (ACL) support enabled.
136 The file system resides locally.
138 The file system has quotas enabled on it.
140 Identifies the root file system.
142 The file system is exported read-only.
144 Updating of file access times is disabled.
146 The file system has been mounted by a user.
150 The file system is exported for both reading and writing.
151 .It Dv MNT_DEFEXPORTED
152 The file system is exported for both reading and writing to any Internet host.
153 .It Dv MNT_EXPORTANON
154 The file system maps all remote accesses to the anonymous user.
156 The file system is exported with Kerberos uid mapping.
158 The file system is exported publicly (WebNFS).
161 Fields that are undefined for a particular file system are set to -1.
165 returns the same information about an open file referenced by descriptor
173 fails if one or more of the following are true:
176 A component of the path prefix of
179 .It Bq Er ENAMETOOLONG
180 The length of a component of
182 exceeds 255 characters,
185 exceeds 1023 characters.
187 The file referred to by
191 Search permission is denied for a component of the path prefix of
194 Too many symbolic links were encountered in translating
202 points to an invalid address.
206 error occurred while reading from or writing to the file system.
208 Corrupted data was detected while reading from the file system.
214 fails if one or more of the following are true:
220 is not a valid open file descriptor.
225 points to an invalid address.
229 error occurred while reading from or writing to the file system.
231 Corrupted data was detected while reading from the file system.
239 system call first appeared in