]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) 2003 Andries Brouwer (aeb@cwi.nl) |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
7 | .\" | |
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. | |
c13182ef | 12 | .\" |
fea681da MK |
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 | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
25 | .\" The pathconf note is from Walter Harms | |
26 | .\" This is not a system call on Linux | |
27 | .\" | |
c11b1abf | 28 | .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com> |
fea681da | 29 | .\" |
4b8c67d9 | 30 | .TH STATVFS 3 2017-09-15 "Linux" "Linux Programmer's Manual" |
fea681da | 31 | .SH NAME |
9ee4a2b6 | 32 | statvfs, fstatvfs \- get filesystem statistics |
fea681da MK |
33 | .SH SYNOPSIS |
34 | .B #include <sys/statvfs.h> | |
68e4db0a | 35 | .PP |
fea681da MK |
36 | .BI "int statvfs(const char *" path ", struct statvfs *" buf ); |
37 | .br | |
38 | .BI "int fstatvfs(int " fd ", struct statvfs *" buf ); | |
39 | .SH DESCRIPTION | |
40 | The function | |
e511ffb6 | 41 | .BR statvfs () |
9ee4a2b6 | 42 | returns information about a mounted filesystem. |
fea681da | 43 | .I path |
9ee4a2b6 | 44 | is the pathname of any file within the mounted filesystem. |
fea681da MK |
45 | .I buf |
46 | is a pointer to a | |
47 | .I statvfs | |
48 | structure defined approximately as follows: | |
847e0d88 | 49 | .PP |
3ad4ddcd | 50 | .in +4n |
b8302363 | 51 | .EX |
cf0a9ace | 52 | struct statvfs { |
a7a5d641 MK |
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 */ | |
df7a3950 MK |
56 | fsblkcnt_t f_bfree; /* Number of free blocks */ |
57 | fsblkcnt_t f_bavail; /* Number of free blocks for | |
58 | unprivileged users */ | |
59 | fsfilcnt_t f_files; /* Number of inodes */ | |
60 | fsfilcnt_t f_ffree; /* Number of free inodes */ | |
61 | fsfilcnt_t f_favail; /* Number of free inodes for | |
62 | unprivileged users */ | |
a7a5d641 MK |
63 | unsigned long f_fsid; /* Filesystem ID */ |
64 | unsigned long f_flag; /* Mount flags */ | |
65 | unsigned long f_namemax; /* Maximum filename length */ | |
cf0a9ace | 66 | }; |
b8302363 | 67 | .EE |
3ad4ddcd | 68 | .in |
847e0d88 | 69 | .PP |
fea681da | 70 | Here the types |
66ee0c7e | 71 | .I fsblkcnt_t |
fea681da | 72 | and |
66ee0c7e | 73 | .I fsfilcnt_t |
fea681da MK |
74 | are defined in |
75 | .IR <sys/types.h> . | |
76 | Both used to be | |
9ff08aad | 77 | .IR "unsigned long" . |
847e0d88 | 78 | .PP |
fea681da MK |
79 | The field |
80 | .I f_flag | |
54083449 MK |
81 | is a bit mask indicating various options that were employed |
82 | when mounting this filesystem. | |
83 | It contains zero or more of the following flags: | |
84 | .\" XXX Keep this list in sync with statfs(2) | |
fea681da | 85 | .TP |
54083449 MK |
86 | .B ST_MANDLOCK |
87 | Mandatory locking is permitted on the filesystem (see | |
88 | .BR fcntl (2)). | |
89 | .TP | |
90 | .B ST_NOATIME | |
91 | Do not update access times; see | |
92 | .BR mount (2). | |
93 | .TP | |
94 | .B ST_NODEV | |
95 | Disallow access to device special files on this filesystem. | |
96 | .TP | |
97 | .B ST_NODIRATIME | |
98 | Do not update directory access times; see | |
99 | .BR mount (2). | |
100 | .TP | |
101 | .B ST_NOEXEC | |
102 | Execution of programs is disallowed on this filesystem. | |
fea681da MK |
103 | .TP |
104 | .B ST_NOSUID | |
54083449 MK |
105 | The set-user-ID and set-group-ID bits are ignored by |
106 | .BR exec (3) | |
107 | for executable files on this filesystem | |
108 | .TP | |
109 | .B ST_RDONLY | |
110 | This filesystem is mounted read-only. | |
111 | .TP | |
112 | .B ST_RELATIME | |
113 | Update atime relative to mtime/ctime; see | |
114 | .BR mount (2). | |
115 | .TP | |
116 | .B ST_SYNCHRONOUS | |
117 | Writes are synched to the filesystem immediately (see the description of | |
118 | .B O_SYNC | |
119 | in | |
120 | .BR open (2)). | |
dd3568a1 | 121 | .PP |
fea681da | 122 | It is unspecified whether all members of the returned struct |
9ee4a2b6 | 123 | have meaningful values on all filesystems. |
847e0d88 | 124 | .PP |
e511ffb6 | 125 | .BR fstatvfs () |
fea681da MK |
126 | returns the same information about an open file referenced by descriptor |
127 | .IR fd . | |
47297adb | 128 | .SH RETURN VALUE |
c13182ef MK |
129 | On success, zero is returned. |
130 | On error, \-1 is returned, and | |
fea681da MK |
131 | .I errno |
132 | is set appropriately. | |
133 | .SH ERRORS | |
134 | .TP | |
135 | .B EACCES | |
1e321034 | 136 | .RB ( statvfs ()) |
fea681da MK |
137 | Search permission is denied for a component of the path prefix of |
138 | .IR path . | |
139 | (See also | |
ad7cc990 | 140 | .BR path_resolution (7).) |
fea681da MK |
141 | .TP |
142 | .B EBADF | |
1e321034 | 143 | .RB ( fstatvfs ()) |
fea681da MK |
144 | .I fd |
145 | is not a valid open file descriptor. | |
146 | .TP | |
147 | .B EFAULT | |
148 | .I Buf | |
149 | or | |
150 | .I path | |
151 | points to an invalid address. | |
152 | .TP | |
153 | .B EINTR | |
bb14af39 MK |
154 | This call was interrupted by a signal; see |
155 | .BR signal (7). | |
fea681da MK |
156 | .TP |
157 | .B EIO | |
9ee4a2b6 | 158 | An I/O error occurred while reading from the filesystem. |
fea681da MK |
159 | .TP |
160 | .B ELOOP | |
1e321034 | 161 | .RB ( statvfs ()) |
fea681da MK |
162 | Too many symbolic links were encountered in translating |
163 | .IR path . | |
164 | .TP | |
165 | .B ENAMETOOLONG | |
1e321034 | 166 | .RB ( statvfs ()) |
fea681da MK |
167 | .I path |
168 | is too long. | |
169 | .TP | |
170 | .B ENOENT | |
1e321034 | 171 | .RB ( statvfs ()) |
fea681da MK |
172 | The file referred to by |
173 | .I path | |
174 | does not exist. | |
175 | .TP | |
176 | .B ENOMEM | |
177 | Insufficient kernel memory was available. | |
178 | .TP | |
179 | .B ENOSYS | |
9ee4a2b6 | 180 | The filesystem does not support this call. |
fea681da MK |
181 | .TP |
182 | .B ENOTDIR | |
1e321034 | 183 | .RB ( statvfs ()) |
fea681da MK |
184 | A component of the path prefix of |
185 | .I path | |
186 | is not a directory. | |
187 | .TP | |
188 | .B EOVERFLOW | |
189 | Some values were too large to be represented in the returned struct. | |
e0cf6f25 | 190 | .SH ATTRIBUTES |
e67472d2 PH |
191 | For an explanation of the terms used in this section, see |
192 | .BR attributes (7). | |
193 | .TS | |
194 | allbox; | |
195 | lbw21 lb lb | |
196 | l l l. | |
197 | Interface Attribute Value | |
198 | T{ | |
199 | .BR statvfs (), | |
e0cf6f25 | 200 | .BR fstatvfs () |
e67472d2 PH |
201 | T} Thread safety MT-Safe |
202 | .TE | |
47297adb | 203 | .SH CONFORMING TO |
41017cbb | 204 | POSIX.1-2001, POSIX.1-2008. |
847e0d88 | 205 | .PP |
54083449 MK |
206 | Only the |
207 | .B ST_NOSUID | |
208 | and | |
209 | .B ST_RDONLY | |
210 | flags of the | |
211 | .I f_flag | |
212 | field are specified in POSIX.1. | |
213 | To obtain definitions of the remaining flags, one must define | |
214 | .BR _GNU_SOURCE . | |
fea681da | 215 | .SH NOTES |
c13182ef | 216 | The Linux kernel has system calls |
0bfa087b | 217 | .BR statfs (2) |
1e321034 | 218 | and |
0bfa087b | 219 | .BR fstatfs (2) |
fea681da | 220 | to support this library call. |
847e0d88 | 221 | .PP |
f019cbb4 MK |
222 | In glibc versions before 2.13, |
223 | .\" glibc commit 3cdaa6adb113a088fdfb87aa6d7747557eccc58d | |
224 | .BR statvfs () | |
225 | populated the bits of the | |
226 | .IR f_flag | |
227 | field by scanning the mount options shown in | |
228 | .IR /proc/mounts . | |
229 | However, starting with Linux 2.6.36, the underlying | |
230 | .BR statfs (2) | |
231 | system call provides the necessary information via the | |
232 | .IR f_flags | |
233 | field, and since glibc version 2.13, the | |
234 | .BR statvfs () | |
235 | function will use information from that field rather than scanning | |
236 | .IR /proc/mounts . | |
847e0d88 | 237 | .PP |
12fcbd0b | 238 | The glibc implementations of |
bdd915e2 MK |
239 | .PP |
240 | .in +4n | |
241 | .EX | |
242 | pathconf(path, _PC_REC_XFER_ALIGN); | |
243 | pathconf(path, _PC_ALLOC_SIZE_MIN); | |
244 | pathconf(path, _PC_REC_MIN_XFER_SIZE); | |
245 | .EE | |
246 | .in | |
247 | .PP | |
11dcec1d | 248 | respectively use the |
fea681da MK |
249 | .IR f_frsize , |
250 | .IR f_frsize , | |
251 | and | |
0daa9e92 | 252 | .I f_bsize |
aaf116b8 MK |
253 | fields returned by a call to |
254 | .BR statvfs () | |
255 | with the argument | |
256 | .IR path . | |
47297adb | 257 | .SH SEE ALSO |
fea681da | 258 | .BR statfs (2) |