1 .\" Copyright (C) 2003 Andries Brouwer (aeb@cwi.nl)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" The pathconf note is from Walter Harms
26 .\" This is not a system call on Linux
28 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
30 .TH STATVFS 3 2021-03-22 "Linux" "Linux Programmer's Manual"
32 statvfs, fstatvfs \- get filesystem statistics
35 .B #include <sys/statvfs.h>
37 .BI "int statvfs(const char *restrict " path \
38 ", struct statvfs *restrict " buf );
39 .BI "int fstatvfs(int " fd ", struct statvfs *" buf );
44 returns information about a mounted filesystem.
46 is the pathname of any file within the mounted filesystem.
50 structure defined approximately as follows:
55 unsigned long f_bsize; /* Filesystem block size */
56 unsigned long f_frsize; /* Fragment size */
57 fsblkcnt_t f_blocks; /* Size of fs in f_frsize units */
58 fsblkcnt_t f_bfree; /* Number of free blocks */
59 fsblkcnt_t f_bavail; /* Number of free blocks for
61 fsfilcnt_t f_files; /* Number of inodes */
62 fsfilcnt_t f_ffree; /* Number of free inodes */
63 fsfilcnt_t f_favail; /* Number of free inodes for
65 unsigned long f_fsid; /* Filesystem ID */
66 unsigned long f_flag; /* Mount flags */
67 unsigned long f_namemax; /* Maximum filename length */
83 is a bit mask indicating various options that were employed
84 when mounting this filesystem.
85 It contains zero or more of the following flags:
86 .\" XXX Keep this list in sync with statfs(2)
89 Mandatory locking is permitted on the filesystem (see
93 Do not update access times; see
97 Disallow access to device special files on this filesystem.
100 Do not update directory access times; see
104 Execution of programs is disallowed on this filesystem.
107 The set-user-ID and set-group-ID bits are ignored by
109 for executable files on this filesystem
112 This filesystem is mounted read-only.
115 Update atime relative to mtime/ctime; see
119 Writes are synched to the filesystem immediately (see the description of
124 It is unspecified whether all members of the returned struct
125 have meaningful values on all filesystems.
128 returns the same information about an open file referenced by descriptor
131 On success, zero is returned.
132 On error, \-1 is returned, and
134 is set to indicate the error.
139 Search permission is denied for a component of the path prefix of
142 .BR path_resolution (7).)
147 is not a valid open file descriptor.
153 points to an invalid address.
156 This call was interrupted by a signal; see
160 An I/O error occurred while reading from the filesystem.
164 Too many symbolic links were encountered in translating
174 The file referred to by
179 Insufficient kernel memory was available.
182 The filesystem does not support this call.
186 A component of the path prefix of
191 Some values were too large to be represented in the returned struct.
193 For an explanation of the terms used in this section, see
201 Interface Attribute Value
205 T} Thread safety MT-Safe
211 POSIX.1-2001, POSIX.1-2008.
219 field are specified in POSIX.1.
220 To obtain definitions of the remaining flags, one must define
223 The Linux kernel has system calls
227 to support this library call.
229 In glibc versions before 2.13,
230 .\" glibc commit 3cdaa6adb113a088fdfb87aa6d7747557eccc58d
232 populated the bits of the
234 field by scanning the mount options shown in
236 However, starting with Linux 2.6.36, the underlying
238 system call provides the necessary information via the
240 field, and since glibc version 2.13, the
242 function will use information from that field rather than scanning
245 The glibc implementations of
249 pathconf(path, _PC_REC_XFER_ALIGN);
250 pathconf(path, _PC_ALLOC_SIZE_MIN);
251 pathconf(path, _PC_REC_MIN_XFER_SIZE);
260 fields returned by a call to