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. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)statfs.2 8.5 (Berkeley) 5/24/95
33 .\" $FreeBSD: src/lib/libc/sys/statfs.2,v 1.9.2.7 2001/12/14 18:34:01 ru Exp $
34 .\" $DragonFly: src/lib/libc/sys/statfs.2,v 1.3 2007/02/25 18:35:05 swildner Exp $
42 .Nd get file system statistics
49 .Fn statfs "const char *path" "struct statfs *buf"
51 .Fn fstatfs "int fd" "struct statfs *buf"
54 returns information about a mounted file system.
56 is the path name of any file within the mounted filesystem.
60 structure defined as follows:
62 typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */
65 * file system statistics
68 #define MFSNAMELEN 16 /* length of fs type name, including null */
69 #define MNAMELEN 90 /* length of buffer for returned name */
72 long f_bsize; /* fundamental file system block size */
73 long f_iosize; /* optimal transfer block size */
74 long f_blocks; /* total data blocks in file system */
75 long f_bfree; /* free blocks in fs */
76 long f_bavail; /* free blocks avail to non-superuser */
77 long f_files; /* total file nodes in file system */
78 long f_ffree; /* free file nodes in fs */
79 fsid_t f_fsid; /* file system id */
80 uid_t f_owner; /* user that mounted the filesystem */
81 int f_type; /* type of filesystem */
82 int f_flags; /* copy of mount flags */
83 long f_syncwrites; /* count of sync writes since mount */
84 long f_asyncwrites; /* count of async writes since mount */
85 char f_fstypename[MFSNAMELEN];/* fs type name */
86 char f_mntonname[MNAMELEN]; /* mount point */
87 long f_syncreads; /* count of sync reads since mount */
88 long f_asyncreads; /* count of async reads since mount */
89 char f_mntfromname[MNAMELEN]; /* mounted filesystem */
92 The flags that may be returned include:
93 .Bl -tag -width MNT_SYNCHRONOUS
95 The filesystem is mounted read-only;
96 Even the super-user may not write on it.
98 Files may not be executed from the filesystem.
100 Setuid and setgid bits on files are not honored when they are executed.
102 Special files in the filesystem may not be opened.
103 .It Dv MNT_SYNCHRONOUS
104 All I/O to the filesystem is done synchronously.
106 No filesystem I/O is done synchronously.
108 The filesystem resides locally.
110 The filesystem has quotas enabled on it.
112 Identifies the root filesystem.
114 The filesystem is exported read-only.
116 The filesystem is exported for both reading and writing.
117 .It Dv MNT_DEFEXPORTED
118 The filesystem is exported for both reading and writing to any Internet host.
119 .It Dv MNT_EXPORTANON
120 The filesystem maps all remote accesses to the anonymous user.
122 The filesystem is exported with Kerberos uid mapping.
125 Fields that are undefined for a particular file system are set to -1.
127 returns the same information about an open file referenced by descriptor
133 fails if one or more of the following are true:
136 A component of the path prefix of
139 .It Bq Er ENAMETOOLONG
140 The length of a component of
142 exceeds 255 characters,
145 exceeds 1023 characters.
147 The file referred to by
151 Search permission is denied for a component of the path prefix of
154 Too many symbolic links were encountered in translating
160 points to an invalid address.
164 error occurred while reading from or writing to the file system.
168 fails if one or more of the following are true:
172 is not a valid open file descriptor.
175 points to an invalid address.
179 error occurred while reading from or writing to the file system.
184 function first appeared in