1 .\" Copyright (C) 2003 Andries Brouwer (aeb@cwi.nl)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Modified 2003-08-17 by Walter Harms
24 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
26 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
27 .\" all rights reserved.
28 .\" Translated Fri Dec 12 00:25:54 JST 1997
29 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
30 .\" Updated & Modified Sat Jun 2 20:25:46 JST 2001
31 .\" by Yuichi SATO <ysato@h4.dion.ne.jp>
32 .\" Updated & Modified Sat Jan 18 16:48:08 JST 2003
33 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
34 .\" Updated & Modified Sun Sep 7 00:52:44 JST 2003 by Yuichi SATO
35 .\" Updated & Modified Sun Jan 9 22:35:28 JST 2005 by Yuichi SATO
36 .\" Updated 2006-07-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
38 .\"WORD: file system ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à
39 .\"WORD: mount ¥Þ¥¦¥ó¥È
40 .\"WORD: pointer ¥Ý¥¤¥ó¥¿¡¼
41 .\"WORD: descriptor ¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼
42 .\"WORD: open ¥ª¡¼¥×¥ó
43 .\"WORD: symbolic link ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯
44 .\"WORD: open ¥ª¡¼¥×¥ó
46 .TH STATFS 2 2004-06-23 "Linux" "Linux Programmer's Manual"
49 .\"O statfs, fstatfs \- get file system statistics
50 statfs, fstatfs \- ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤ÎÅý·×¤òÆÀ¤ë
53 .\"O .BR "#include <sys/vfs.h> " "/* or <sys/statfs.h> */"
54 .BR "#include <sys/vfs.h> " "/* ¤Þ¤¿¤Ï <sys/statfs.h> */"
56 .BI "int statfs(const char *" path ", struct statfs *" buf );
58 .BI "int fstatfs(int " fd ", struct statfs *" buf );
63 .\"O returns information about a mounted file system.
66 ¤Ï¥Þ¥¦¥ó¥È¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤òÊÖ¤¹¡£
68 .\"O is the pathname of any file within the mounted file system.
70 ¤Ï¥Þ¥¦¥ó¥È¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹Ì¾¤Ç¤¢¤ë¡£
72 .\"O is a pointer to a
74 .\"O structure defined approximately as follows:
78 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¡¼¤Ç¡¢¤ª¤è¤½°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤ë:
83 .\"O long f_type; /* type of file system (see below) */
84 long f_type; /* ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î·¿ (²¼µ»²¾È) */
85 .\"O long f_bsize; /* optimal transfer block size */
86 long f_bsize; /* ºÇŬ¤Ê¥Ö¥í¥Ã¥¯¥µ¥¤¥º */
87 .\"O long f_blocks; /* total data blocks in file system */
88 long f_blocks; /* ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ÎÁí¥Ç¡¼¥¿¥Ö¥í¥Ã¥¯¿ô */
89 .\"O long f_bfree; /* free blocks in fs */
90 long f_bfree; /* ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¶õ¤¥Ö¥í¥Ã¥¯¿ô */
91 .\"O long f_bavail; /* free blocks avail to unprivileged user */
92 long f_bavail; /* ÈóÆø¢¥æ¡¼¥¶¤¬»ÈÍѲÄǽ¤Ê¶õ¤¥Ö¥í¥Ã¥¯¿ô */
93 .\"O long f_files; /* total file nodes in file system */
94 long f_files; /* ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ÎÁí¥Õ¥¡¥¤¥ë¥Î¡¼¥É¿ô */
95 .\"O long f_ffree; /* free file nodes in fs */
96 long f_ffree; /* ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¶õ¤¥Õ¥¡¥¤¥ë¥Î¡¼¥É¿ô */
97 .\"O fsid_t f_fsid; /* file system id */
98 fsid_t f_fsid; /* ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î ID */
99 .\"O long f_namelen; /* maximum length of filenames */
100 long f_namelen; /* ¥Õ¥¡¥¤¥ë̾¤ÎºÇÂçĹ */
103 .\"O File system types:
104 ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤Î·¿:
106 ADFS_SUPER_MAGIC 0xadf5
107 AFFS_SUPER_MAGIC 0xADFF
108 BEFS_SUPER_MAGIC 0x42465331
110 CIFS_MAGIC_NUMBER 0xFF534D42
111 CODA_SUPER_MAGIC 0x73757245
112 COH_SUPER_MAGIC 0x012FF7B7
113 CRAMFS_MAGIC 0x28cd3d45
114 DEVFS_SUPER_MAGIC 0x1373
115 EFS_SUPER_MAGIC 0x00414A53
116 EXT_SUPER_MAGIC 0x137D
117 EXT2_OLD_SUPER_MAGIC 0xEF51
118 EXT2_SUPER_MAGIC 0xEF53
119 EXT3_SUPER_MAGIC 0xEF53
120 HFS_SUPER_MAGIC 0x4244
121 HPFS_SUPER_MAGIC 0xF995E849
122 HUGETLBFS_MAGIC 0x958458f6
123 ISOFS_SUPER_MAGIC 0x9660
124 JFFS2_SUPER_MAGIC 0x72b6
125 JFS_SUPER_MAGIC 0x3153464a
126 .\"O MINIX_SUPER_MAGIC 0x137F /* orig. minix */
127 MINIX_SUPER_MAGIC 0x137F /* ¥ª¥ê¥¸¥Ê¥ë¤Î minix */
128 .\"O MINIX_SUPER_MAGIC2 0x138F /* 30 char minix */
129 MINIX_SUPER_MAGIC2 0x138F /* 30 ʸ»ú¥Õ¥¡¥¤¥ë̾¤Î minix */
130 MINIX2_SUPER_MAGIC 0x2468 /* minix V2 */
131 .\"O MINIX2_SUPER_MAGIC2 0x2478 /* minix V2, 30 char names */
132 MINIX2_SUPER_MAGIC2 0x2478 /* minix V2, 30 ʸ»ú¥Õ¥¡¥¤¥ë̾ */
133 MSDOS_SUPER_MAGIC 0x4d44
134 NCP_SUPER_MAGIC 0x564c
135 NFS_SUPER_MAGIC 0x6969
136 NTFS_SB_MAGIC 0x5346544e
137 OPENPROM_SUPER_MAGIC 0x9fa1
138 PROC_SUPER_MAGIC 0x9fa0
139 QNX4_SUPER_MAGIC 0x002f
140 REISERFS_SUPER_MAGIC 0x52654973
142 SMB_SUPER_MAGIC 0x517B
143 SYSV2_SUPER_MAGIC 0x012FF7B6
144 SYSV4_SUPER_MAGIC 0x012FF7B5
145 TMPFS_MAGIC 0x01021994
146 UDF_SUPER_MAGIC 0x15013346
148 USBDEVICE_SUPER_MAGIC 0x9fa2
149 VXFS_SUPER_MAGIC 0xa501FCF5
150 XENIX_SUPER_MAGIC 0x012FF7B4
151 XFS_SUPER_MAGIC 0x58465342
152 _XIAFS_SUPER_MAGIC 0x012FD16D
156 .\"O Nobody knows what
158 .\"O is supposed to contain (but see below).
160 ¤Ë¤É¤ó¤ÊÃͤ¬Æþ¤ë¤Ù¤¤Ê¤Î¤«¤Ïï¤âÃΤé¤Ê¤¤ (⤷¡¢²¼µ¤ò»²¾È)¡£
162 .\"O Fields that are undefined for a particular file system are set to 0.
164 .\"O returns the same information about an open file referenced by descriptor
166 ¤½¤ì¤¾¤ì¤Î¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤Ë¤ª¤¤¤Æ̤ÄêµÁ¤Î¥Õ¥£¡¼¥ë¥É¤Ë¤Ï 0 ¤¬
171 ¤Ë¤è¤Ã¤Æ»²¾È¤µ¤ì¤ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ¡¢Æ±¤¸¾ðÊó¤òÊÖ¤¹¡£
172 .\"O .SH "RETURN VALUE"
174 .\"O On success, zero is returned.
175 .\"O On error, \-1 is returned, and
177 .\"O is set appropriately.
178 À®¸ù¤¹¤ì¤Ð 0 ¤¬ÊÖ¤µ¤ì¤ë¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
185 .\"O .RB ( statfs ())
186 .\"O Search permission is denied for a component of the path prefix of
191 ¤Î¥Ç¥£¥ì¥¯¥È¥êÉôʬ¤Ë¸¡º÷µö²Ä¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤
193 .\"O .BR path_resolution (7).)
194 .RB ( path_resolution (7)
198 .\"O .RB ( fstatfs ())
200 .\"O is not a valid open file descriptor.
204 ¤Ï͸ú¤Ê¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤Ç¤Ï¤Ê¤¤¡£
210 .\"O points to an invalid address.
214 ¤¬ÉÔÀµ¤Ê¥¢¥É¥ì¥¹¤ò»Ø¤·¤Æ¤¤¤ë¡£
217 .\"O This call was interrupted by a signal.
218 ¤³¤Î¸Æ¤Ó½Ð¤·¤¬¥·¥°¥Ê¥ë¤ÇÃæÃǤµ¤ì¤¿¡£
221 .\"O An I/O error occurred while reading from the file system.
222 ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤ÎÆɤ߹þ¤ß¤Î´Ö¤Ë I/O ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
225 .\"O .RB ( statfs ())
226 .\"O Too many symbolic links were encountered in translating
231 ¤ò²ò·è¤¹¤ë¤Î¤Ëé¤ë¤Ù¤¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤¬Â¿¤¹¤®¤ë¡£
234 .\"O .RB ( statfs ())
243 .\"O .RB ( statfs ())
244 .\"O The file referred to by
250 ¤Ë¤è¤Ã¤Æ»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤¤¡£
253 .\"O Insufficient kernel memory was available.
254 ¥«¡¼¥Í¥ë¤Ë½½Ê¬¤Ê¥á¥â¥ê¤¬¤Ê¤¤¡£
257 .\"O The file system does not support this call.
258 ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤¬¤³¤Î¸Æ¤Ó½Ð¤·¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£
261 .\"O .RB ( statfs ())
262 .\"O A component of the path prefix of
264 .\"O is not a directory.
268 ¤Î¥Ç¥£¥ì¥¯¥È¥êÉôʬ¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¡£
271 .\"O Some values were too large to be represented in the returned struct.
272 Ãͤ¬Â礲᤮¤ë¤¿¤á¡¢ÊÖ¤êÃͤι½Â¤ÂΤÇɽ¸½¤Ç¤¤Ê¤¤¡£
273 .\"O .SH "CONFORMING TO"
278 .\"O was inspired by the 4.4BSD one
279 .\"O (but they do not use the same structure).
283 ¤Ï 4.4BSD ¤Î¤â¤Î¤Ë±Æ¶Á¤ò¼õ¤±¤Æ¤¤¤ë¡£
284 (¤·¤«¤·Æ±¤¸¹½Â¤ÂΤò»ÈÍѤ·¤Æ¤¤¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤)
287 .\"O The kernel has system calls
290 .\"O .BR statfs64 (),
292 .\"O .BR fstatfs64 ()
293 .\"O to support this library call.
294 ¤³¤Î¥é¥¤¥Ö¥é¥ê¥³¡¼¥ë¤ò¥µ¥Ý¡¼¥È¤¹¤ë¤¿¤á¡¢
295 ¥«¡¼¥Í¥ë¤Ë¤Ï¥·¥¹¥Æ¥à¥³¡¼¥ë
302 .\"O Some systems only have \fI<sys/vfs.h>\fP, other systems also have
303 .\"O \fI<sys/statfs.h>\fP, where the former includes the latter.
305 .\"O including the former is the best choice.
306 \fI<sys/vfs.h>\fP ¤·¤«»ý¤¿¤Ê¤¤¥·¥¹¥Æ¥à¤â¤¢¤ê¡¢
307 \fI<sys/statfs.h>\fP ¤â»ý¤Ã¤Æ¤¤¤ë¥·¥¹¥Æ¥à¤â¤¢¤ë¡£
308 Á°¼Ô¤Ï¸å¼Ô¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤Î¤Ç¡¢
309 Á°¼Ô¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤Î¤¬Îɤ¤¤È¹Í¤¨¤é¤ì¤ë¡£
311 .\"O LSB has deprecated the library calls
315 .\"O and tells us to use
318 .\"O .BR fstatvfs (2)
320 LSB ¤Ç¤Ï¥é¥¤¥Ö¥é¥ê¥³¡¼¥ë
323 ¤òÈó¿ä¾©¤È¤·¤Æ¡¢Âå¤ï¤ê¤Ë
326 ¤ò»È¤¦¤è¤¦¤Ë»Ø¼¨¤·¤Æ¤¤¤ë¡£
327 .\"O .SS The f_fsid field
328 .SS f_fsid ¥Õ¥£¡¼¥ë¥É
329 .\"O Solaris, Irix and POSIX have a system call
332 .\"O .I "struct statvfs"
334 .\"O .IR <sys/statvfs.h> )
336 .\"O .I "unsigned long"
338 Solaris, Irix, POSIX ¤Ë¤Ï¥·¥¹¥Æ¥à¥³¡¼¥ë
343 .RI ( <sys/statvfs.h>
349 .\"O Linux, SunOS, HP-UX, 4.4BSD have a system call
352 .\"O .I "struct statfs"
354 .\"O .IR <sys/vfs.h> )
361 .\"O .IR "struct { int val[2]; }" .
362 Linux, SunOS, HP-UX, 4.4BSD ¤Ë¤Ï¥·¥¹¥Æ¥à¥³¡¼¥ë
375 .I "struct { int val[2]; }"
377 .\"O The same holds for FreeBSD, except that it uses the include file
378 .\"O .IR <sys/mount.h> .
379 FreeBSD ¤Ç¤âƱ¤¸¤Ç¤¢¤ë¤¬¡¢¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
383 .\"O The general idea is that
385 .\"O contains some random stuff such that the pair
386 .\"O .RI ( f_fsid , ino )
387 .\"O uniquely determines a file.
389 ¤Ï¤¢¤ë¥é¥ó¥À¥à¤ÊÃͤò»ý¤Á¡¢
391 ¤È¤¤¤¦ 1 ÁȤÎÃͤǥե¡¥¤¥ë¤ò°ì°Õ¤Ë·èÄê¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¡¢
392 ¤È¤¤¤¦¤Î¤¬´ðËÜŪ¤Ê¹Í¤¨Êý¤Ç¤¢¤ë¡£
393 .\"O Some OSes use (a variation on) the device number, or the device number
394 .\"O combined with the file-system type.
395 ¤¤¤¯¤Ä¤«¤Î OS ¤Ç¤Ï¡¢¥Ç¥Ð¥¤¥¹ÈÖ¹æ (¤ÎÊѼï) ¤ò»È¤Ã¤¿¤ê¡¢
396 ¥Ç¥Ð¥¤¥¹ÈÖ¹æ¤È¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¥¿¥¤¥×¤òÁȤ߹ç¤ï¤»¤Æ»È¤Ã¤¿¤ê¤·¤Æ¤¤¤ë¡£
397 .\"O Several OSes restrict giving out the
399 .\"O field to the superuser only (and zero it for unprivileged users),
400 .\"O because this field is used in the filehandle of the file system
401 .\"O when NFS-exported, and giving it out is a security concern.
404 ¥Õ¥£¡¼¥ë¥É¤Î¼èÆÀ¤ò¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¤Ë¸ÂÄꤷ¤Æ¤¤¤ë¤â¤Î¤â¤¢¤ë
405 (ÈóÆø¢¥æ¡¼¥¶¤¬¼èÆÀ¤¹¤ë¤È 0 ¤È¤Ê¤ë)¡£
406 NFS ¤Ç¥¨¥¯¥¹¥Ý¡¼¥È¤µ¤ì¤ë¾ì¹ç¡¢
407 ¤³¤Î¥Õ¥£¡¼¥ë¥É¤¬¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤Î¥Õ¥¡¥¤¥ë¥Ï¥ó¥É¥ë¤Ç»È¤ï¤ì¤Æ¤ª¤ê¡¢
408 ¤³¤ÎÃͤòÄ󶡤¹¤ë¤È¥»¥¥å¥ê¥Æ¥£¾å¤ÎÌäÂ꤬¤¢¤ë¡£
410 .\"O Under some OSes the
412 .\"O can be used as second argument to the
419 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÎÂè 2 °ú¤¿ô¤È¤·¤Æ»ÈÍѤǤ¤ë¡£
424 .BR path_resolution (7)