2 .\" Copyright (C) 2003 Andries Brouwer (aeb@cwi.nl)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" The pathconf note is from Walter Harms
7 .\" This is not a system call on Linux
9 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
11 .TH statvfs 3 (date) "Linux man-pages (unreleased)"
13 statvfs, fstatvfs \- get filesystem statistics
16 .RI ( libc ", " \-lc )
19 .B #include <sys/statvfs.h>
21 .BI "int statvfs(const char *restrict " path \
22 ", struct statvfs *restrict " buf );
23 .BI "int fstatvfs(int " fd ", struct statvfs *" buf );
28 returns information about a mounted filesystem.
30 is the pathname of any file within the mounted filesystem.
34 structure defined approximately as follows:
39 unsigned long f_bsize; /* Filesystem block size */
40 unsigned long f_frsize; /* Fragment size */
41 fsblkcnt_t f_blocks; /* Size of fs in f_frsize units */
42 fsblkcnt_t f_bfree; /* Number of free blocks */
43 fsblkcnt_t f_bavail; /* Number of free blocks for
45 fsfilcnt_t f_files; /* Number of inodes */
46 fsfilcnt_t f_ffree; /* Number of free inodes */
47 fsfilcnt_t f_favail; /* Number of free inodes for
49 unsigned long f_fsid; /* Filesystem ID */
50 unsigned long f_flag; /* Mount flags */
51 unsigned long f_namemax; /* Maximum filename length */
67 is a bit mask indicating various options that were employed
68 when mounting this filesystem.
69 It contains zero or more of the following flags:
70 .\" XXX Keep this list in sync with statfs(2)
73 Mandatory locking is permitted on the filesystem (see
77 Do not update access times; see
81 Disallow access to device special files on this filesystem.
84 Do not update directory access times; see
88 Execution of programs is disallowed on this filesystem.
91 The set-user-ID and set-group-ID bits are ignored by
93 for executable files on this filesystem
96 This filesystem is mounted read-only.
99 Update atime relative to mtime/ctime; see
103 Writes are synched to the filesystem immediately (see the description of
108 It is unspecified whether all members of the returned struct
109 have meaningful values on all filesystems.
112 returns the same information about an open file referenced by descriptor
115 On success, zero is returned.
116 On error, \-1 is returned, and
118 is set to indicate the error.
123 Search permission is denied for a component of the path prefix of
126 .BR path_resolution (7).)
131 is not a valid open file descriptor.
137 points to an invalid address.
140 This call was interrupted by a signal; see
144 An I/O error occurred while reading from the filesystem.
148 Too many symbolic links were encountered in translating
158 The file referred to by
163 Insufficient kernel memory was available.
166 The filesystem does not support this call.
170 A component of the path prefix of
175 Some values were too large to be represented in the returned struct.
177 For an explanation of the terms used in this section, see
183 Interface Attribute Value
189 T} Thread safety MT-Safe
198 field are specified in POSIX.1.
199 To obtain definitions of the remaining flags, one must define
202 The Linux kernel has system calls
206 to support this library call.
208 The glibc implementations of
212 pathconf(path, _PC_REC_XFER_ALIGN);
213 pathconf(path, _PC_ALLOC_SIZE_MIN);
214 pathconf(path, _PC_REC_MIN_XFER_SIZE);
223 fields returned by a call to
230 is always the same as
232 and there's no way for a filesystem to report otherwise.
233 This is not an issue,
234 since no filesystems with an inode root reservation exist.
241 .\" glibc commit 3cdaa6adb113a088fdfb87aa6d7747557eccc58d
243 populated the bits of the
245 field by scanning the mount options shown in
247 However, starting with Linux 2.6.36, the underlying
249 system call provides the necessary information via the
251 field, and since glibc 2.13, the
253 function will use information from that field rather than scanning