1 .\" Copyright (C) 2003 Andries Brouwer (aeb@cwi.nl)
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" The pathconf note is from Walter Harms
6 .\" This is not a system call on Linux
8 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
10 .TH STATVFS 3 2021-03-22 "Linux" "Linux Programmer's Manual"
12 statvfs, fstatvfs \- get filesystem statistics
15 .RI ( libc ", " \-lc )
18 .B #include <sys/statvfs.h>
20 .BI "int statvfs(const char *restrict " path \
21 ", struct statvfs *restrict " buf );
22 .BI "int fstatvfs(int " fd ", struct statvfs *" buf );
27 returns information about a mounted filesystem.
29 is the pathname of any file within the mounted filesystem.
33 structure defined approximately as follows:
38 unsigned long f_bsize; /* Filesystem block size */
39 unsigned long f_frsize; /* Fragment size */
40 fsblkcnt_t f_blocks; /* Size of fs in f_frsize units */
41 fsblkcnt_t f_bfree; /* Number of free blocks */
42 fsblkcnt_t f_bavail; /* Number of free blocks for
44 fsfilcnt_t f_files; /* Number of inodes */
45 fsfilcnt_t f_ffree; /* Number of free inodes */
46 fsfilcnt_t f_favail; /* Number of free inodes for
48 unsigned long f_fsid; /* Filesystem ID */
49 unsigned long f_flag; /* Mount flags */
50 unsigned long f_namemax; /* Maximum filename length */
66 is a bit mask indicating various options that were employed
67 when mounting this filesystem.
68 It contains zero or more of the following flags:
69 .\" XXX Keep this list in sync with statfs(2)
72 Mandatory locking is permitted on the filesystem (see
76 Do not update access times; see
80 Disallow access to device special files on this filesystem.
83 Do not update directory access times; see
87 Execution of programs is disallowed on this filesystem.
90 The set-user-ID and set-group-ID bits are ignored by
92 for executable files on this filesystem
95 This filesystem is mounted read-only.
98 Update atime relative to mtime/ctime; see
102 Writes are synched to the filesystem immediately (see the description of
107 It is unspecified whether all members of the returned struct
108 have meaningful values on all filesystems.
111 returns the same information about an open file referenced by descriptor
114 On success, zero is returned.
115 On error, \-1 is returned, and
117 is set to indicate the error.
122 Search permission is denied for a component of the path prefix of
125 .BR path_resolution (7).)
130 is not a valid open file descriptor.
136 points to an invalid address.
139 This call was interrupted by a signal; see
143 An I/O error occurred while reading from the filesystem.
147 Too many symbolic links were encountered in translating
157 The file referred to by
162 Insufficient kernel memory was available.
165 The filesystem does not support this call.
169 A component of the path prefix of
174 Some values were too large to be represented in the returned struct.
176 For an explanation of the terms used in this section, see
184 Interface Attribute Value
188 T} Thread safety MT-Safe
194 POSIX.1-2001, POSIX.1-2008.
202 field are specified in POSIX.1.
203 To obtain definitions of the remaining flags, one must define
206 The Linux kernel has system calls
210 to support this library call.
212 In glibc versions before 2.13,
213 .\" glibc commit 3cdaa6adb113a088fdfb87aa6d7747557eccc58d
215 populated the bits of the
217 field by scanning the mount options shown in
219 However, starting with Linux 2.6.36, the underlying
221 system call provides the necessary information via the
223 field, and since glibc version 2.13, the
225 function will use information from that field rather than scanning
228 The glibc implementations of
232 pathconf(path, _PC_REC_XFER_ALIGN);
233 pathconf(path, _PC_ALLOC_SIZE_MIN);
234 pathconf(path, _PC_REC_MIN_XFER_SIZE);
243 fields returned by a call to