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 2013-09-26 "Linux" "Linux Programmer's Manual"
32 statvfs, fstatvfs \- get filesystem statistics
34 .B #include <sys/statvfs.h>
36 .BI "int statvfs(const char *" path ", struct statvfs *" buf );
38 .BI "int fstatvfs(int " fd ", struct statvfs *" buf );
42 returns information about a mounted filesystem.
44 is the pathname of any file within the mounted filesystem.
48 structure defined approximately as follows:
53 unsigned long f_bsize; /* filesystem block size */
54 unsigned long f_frsize; /* fragment size */
55 fsblkcnt_t f_blocks; /* size of fs in f_frsize units */
56 fsblkcnt_t f_bfree; /* # free blocks */
57 fsblkcnt_t f_bavail; /* # free blocks for unprivileged users */
58 fsfilcnt_t f_files; /* # inodes */
59 fsfilcnt_t f_ffree; /* # free inodes */
60 fsfilcnt_t f_favail; /* # free inodes for unprivileged users */
61 unsigned long f_fsid; /* filesystem ID */
62 unsigned long f_flag; /* mount flags */
63 unsigned long f_namemax; /* maximum filename length */
79 is a bit mask (of mount flags, see
81 Bits defined by POSIX are
87 Set-user-ID/set-group-ID bits are ignored by
90 It is unspecified whether all members of the returned struct
91 have meaningful values on all filesystems.
94 returns the same information about an open file referenced by descriptor
97 On success, zero is returned.
98 On error, \-1 is returned, and
100 is set appropriately.
105 Search permission is denied for a component of the path prefix of
108 .BR path_resolution (7).)
113 is not a valid open file descriptor.
119 points to an invalid address.
122 This call was interrupted by a signal.
125 An I/O error occurred while reading from the filesystem.
129 Too many symbolic links were encountered in translating
139 The file referred to by
144 Insufficient kernel memory was available.
147 The filesystem does not support this call.
151 A component of the path prefix of
156 Some values were too large to be represented in the returned struct.
158 .SS Multithreading (see pthreads(7))
163 functions are thread-safe.
167 The Linux kernel has system calls
171 to support this library call.
173 The current glibc implementations of
176 pathconf(path, _PC_REC_XFER_ALIGN);
177 pathconf(path, _PC_ALLOC_SIZE_MIN);
178 pathconf(path, _PC_REC_MIN_XFER_SIZE);
186 fields of the return value of
187 .IR "statvfs(path,buf)" .