-
Notifications
You must be signed in to change notification settings - Fork 0
/
fstatvfs.html
375 lines (265 loc) · 9.67 KB
/
fstatvfs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<!-- Creator : groff version 1.22.4 -->
<!-- CreationDate: Wed Jan 29 11:27:05 2020 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>STATVFS</title>
</head>
<body>
<h1 align="center">STATVFS</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#RETURN VALUE">RETURN VALUE</a><br>
<a href="#ERRORS">ERRORS</a><br>
<a href="#ATTRIBUTES">ATTRIBUTES</a><br>
<a href="#CONFORMING TO">CONFORMING TO</a><br>
<a href="#NOTES">NOTES</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<a href="#COLOPHON">COLOPHON</a><br>
<hr>
<h2>NAME
<a name="NAME"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">statvfs,
fstatvfs - get filesystem statistics</p>
<h2>SYNOPSIS
<a name="SYNOPSIS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>#include
<sys/statvfs.h></b></p>
<p style="margin-left:11%; margin-top: 1em"><b>int
statvfs(const char *</b><i>path</i><b>, struct statvfs
*</b><i>buf</i><b>); <br>
int fstatvfs(int</b> <i>fd</i><b>, struct statvfs
*</b><i>buf</i><b>);</b></p>
<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The function
<b>statvfs</b>() returns information about a mounted
filesystem. <i>path</i> is the pathname of any file within
the mounted filesystem. <i>buf</i> is a pointer to a
<i>statvfs</i> structure defined approximately as
follows:</p>
<p style="margin-left:17%; margin-top: 1em">struct statvfs
{ <br>
unsigned long f_bsize; /* Filesystem block size */ <br>
unsigned long f_frsize; /* Fragment size */ <br>
fsblkcnt_t f_blocks; /* Size of fs in f_frsize units */ <br>
fsblkcnt_t f_bfree; /* Number of free blocks */ <br>
fsblkcnt_t f_bavail; /* Number of free blocks for <br>
unprivileged users */ <br>
fsfilcnt_t f_files; /* Number of inodes */ <br>
fsfilcnt_t f_ffree; /* Number of free inodes */ <br>
fsfilcnt_t f_favail; /* Number of free inodes for <br>
unprivileged users */ <br>
unsigned long f_fsid; /* Filesystem ID */ <br>
unsigned long f_flag; /* Mount flags */ <br>
unsigned long f_namemax; /* Maximum filename length */ <br>
};</p>
<p style="margin-left:11%; margin-top: 1em">Here the types
<i>fsblkcnt_t</i> and <i>fsfilcnt_t</i> are defined in
<i><sys/types.h></i>. Both used to be <i>unsigned
long</i>.</p>
<p style="margin-left:11%; margin-top: 1em">The field
<i>f_flag</i> is a bit mask indicating various options that
were employed when mounting this filesystem. It contains
zero or more of the following flags: <b><br>
ST_MANDLOCK</b></p>
<p style="margin-left:22%;">Mandatory locking is permitted
on the filesystem (see <b>fcntl</b>(2)).</p>
<p style="margin-left:11%;"><b>ST_NOATIME</b></p>
<p style="margin-left:22%;">Do not update access times; see
<b>mount</b>(2).</p>
<p style="margin-left:11%;"><b>ST_NODEV</b></p>
<p style="margin-left:22%;">Disallow access to device
special files on this filesystem.</p>
<p style="margin-left:11%;"><b>ST_NODIRATIME</b></p>
<p style="margin-left:22%;">Do not update directory access
times; see <b>mount</b>(2).</p>
<p style="margin-left:11%;"><b>ST_NOEXEC</b></p>
<p style="margin-left:22%;">Execution of programs is
disallowed on this filesystem.</p>
<p style="margin-left:11%;"><b>ST_NOSUID</b></p>
<p style="margin-left:22%;">The set-user-ID and
set-group-ID bits are ignored by <b>exec</b>(3) for
executable files on this filesystem</p>
<p style="margin-left:11%;"><b>ST_RDONLY</b></p>
<p style="margin-left:22%;">This filesystem is mounted
read-only.</p>
<p style="margin-left:11%;"><b>ST_RELATIME</b></p>
<p style="margin-left:22%;">Update atime relative to
mtime/ctime; see <b>mount</b>(2).</p>
<p style="margin-left:11%;"><b>ST_SYNCHRONOUS</b></p>
<p style="margin-left:22%;">Writes are synched to the
filesystem immediately (see the description of <b>O_SYNC</b>
in <b>open</b>(2)).</p>
<p style="margin-left:11%; margin-top: 1em">It is
unspecified whether all members of the returned struct have
meaningful values on all filesystems.</p>
<p style="margin-left:11%; margin-top: 1em"><b>fstatvfs</b>()
returns the same information about an open file referenced
by descriptor <i>fd</i>.</p>
<h2>RETURN VALUE
<a name="RETURN VALUE"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">On success,
zero is returned. On error, -1 is returned, and <i>errno</i>
is set appropriately.</p>
<h2>ERRORS
<a name="ERRORS"></a>
</h2>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p style="margin-top: 1em"><b>EACCES</b></p></td>
<td width="2%"></td>
<td width="78%">
<p style="margin-top: 1em">(<b>statvfs</b>()) Search
permission is denied for a component of the path prefix of
<i>path</i>. (See also <b>path_resolution</b>(7).)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EBADF</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>(<b>fstatvfs</b>()) <i>fd</i> is not a valid open file
descriptor.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EFAULT</b></p></td>
<td width="2%"></td>
<td width="78%">
<p><i>Buf</i> or <i>path</i> points to an invalid
address.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINTR</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>This call was interrupted by a signal; see
<b>signal</b>(7).</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EIO</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>An I/O error occurred while reading from the
filesystem.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ELOOP</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>(<b>statvfs</b>()) Too many symbolic links were
encountered in translating <i>path</i>.</p></td></tr>
</table>
<p style="margin-left:11%;"><b>ENAMETOOLONG</b></p>
<p style="margin-left:22%;">(<b>statvfs</b>()) <i>path</i>
is too long.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ENOENT</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>(<b>statvfs</b>()) The file referred to by <i>path</i>
does not exist.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ENOMEM</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>Insufficient kernel memory was available.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ENOSYS</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>The filesystem does not support this call.</p></td></tr>
</table>
<p style="margin-left:11%;"><b>ENOTDIR</b></p>
<p style="margin-left:22%;">(<b>statvfs</b>()) A component
of the path prefix of <i>path</i> is not a directory.</p>
<p style="margin-left:11%;"><b>EOVERFLOW</b></p>
<p style="margin-left:22%;">Some values were too large to
be represented in the returned struct.</p>
<h2>ATTRIBUTES
<a name="ATTRIBUTES"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">For an
explanation of the terms used in this section, see
<b>attributes</b>(7).</p>
<p align="center" style="margin-top: 1em"><img src="grohtml-555021.png" alt="Image grohtml-555021.png"></p>
<h2>CONFORMING TO
<a name="CONFORMING TO"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">POSIX.1-2001,
POSIX.1-2008.</p>
<p style="margin-left:11%; margin-top: 1em">Only the
<b>ST_NOSUID</b> and <b>ST_RDONLY</b> flags of the
<i>f_flag</i> field are specified in POSIX.1. To obtain
definitions of the remaining flags, one must define
<b>_GNU_SOURCE</b>.</p>
<h2>NOTES
<a name="NOTES"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The Linux
kernel has system calls <b>statfs</b>(2) and
<b>fstatfs</b>(2) to support this library call.</p>
<p style="margin-left:11%; margin-top: 1em">In glibc
versions before 2.13, <b>statvfs</b>() populated the bits of
the <i>f_flag</i> field by scanning the mount options shown
in <i>/proc/mounts</i>. However, starting with Linux 2.6.36,
the underlying <b>statfs</b>(2) system call provides the
necessary information via the <i>f_flags</i> field, and
since glibc version 2.13, the <b>statvfs</b>() function will
use information from that field rather than scanning
<i>/proc/mounts</i>.</p>
<p style="margin-left:11%; margin-top: 1em">The glibc
implementations of</p>
<p style="margin-left:17%; margin-top: 1em">pathconf(path,
_PC_REC_XFER_ALIGN); <br>
pathconf(path, _PC_ALLOC_SIZE_MIN); <br>
pathconf(path, _PC_REC_MIN_XFER_SIZE);</p>
<p style="margin-left:11%; margin-top: 1em">respectively
use the <i>f_frsize</i>, <i>f_frsize</i>, and <i>f_bsize</i>
fields returned by a call to <b>statvfs</b>() with the
argument <i>path</i>.</p>
<h2>SEE ALSO
<a name="SEE ALSO"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>statfs</b>(2)</p>
<h2>COLOPHON
<a name="COLOPHON"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">This page is
part of release 5.02 of the Linux <i>man-pages</i> project.
A description of the project, information about reporting
bugs, and the latest version of this page, can be found at
https://www.kernel.org/doc/man-pages/.</p>
<hr>
</body>
</html>