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 ファイル・システム
40 .\"WORD: pointer ポインター
41 .\"WORD: descriptor ディスクリプター
43 .\"WORD: symbolic link シンボリック・リンク
46 .TH STATFS 2 2010-09-04 "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 構造体へのポインターで、およそ以下のように定義される:
82 .\"O #if __WORDSIZE == 32 /* System word size */
83 #if __WORDSIZE == 32 /* システムのワードサイズ */
84 # define __SWORD_TYPE int
85 #else /* __WORDSIZE == 64 */
86 # define __SWORD_TYPE long int
90 .\"O __SWORD_TYPE f_type; /* type of file system (see below) */
91 .\"O __SWORD_TYPE f_bsize; /* optimal transfer block size */
92 .\"O fsblkcnt_t f_blocks; /* total data blocks in file system */
93 .\"O fsblkcnt_t f_bfree; /* free blocks in fs */
94 .\"O fsblkcnt_t f_bavail; /* free blocks available to
95 .\"O unprivileged user */
96 .\"O fsfilcnt_t f_files; /* total file nodes in file system */
97 .\"O fsfilcnt_t f_ffree; /* free file nodes in fs */
98 .\"O fsid_t f_fsid; /* file system id */
99 .\"O __SWORD_TYPE f_namelen; /* maximum length of filenames */
100 .\"O __SWORD_TYPE f_frsize; /* fragment size (since Linux 2.6) */
101 .\"O __SWORD_TYPE f_spare[5];
102 __SWORD_TYPE f_type; /* ファイルシステムの種別 (下記参照) */
103 __SWORD_TYPE f_bsize; /* 最適な転送ブロックサイズ */
104 fsblkcnt_t f_blocks; /* ファイルシステムの総データブロック数 */
105 fsblkcnt_t f_bfree; /* ファイルシステムの空きブロック数 */
106 fsblkcnt_t f_bavail; /* 非特権ユーザが利用可能な空きブロック数 */
107 fsfilcnt_t f_files; /* ファイルシステムの総ファイルノード数 */
108 fsfilcnt_t f_ffree; /* ファイルシステムの空きファイルノード数 */
109 fsid_t f_fsid; /* ファイルシステムの ID */
110 __SWORD_TYPE f_namelen; /* ファイル名の最大長 */
111 __SWORD_TYPE f_frsize; /* フラグメントサイズ (Linux 2.6 以降) */
112 __SWORD_TYPE f_spare[5];
115 .\"O File system types:
118 ADFS_SUPER_MAGIC 0xadf5
119 AFFS_SUPER_MAGIC 0xADFF
120 BEFS_SUPER_MAGIC 0x42465331
122 CIFS_MAGIC_NUMBER 0xFF534D42
123 CODA_SUPER_MAGIC 0x73757245
124 COH_SUPER_MAGIC 0x012FF7B7
125 CRAMFS_MAGIC 0x28cd3d45
126 DEVFS_SUPER_MAGIC 0x1373
127 EFS_SUPER_MAGIC 0x00414A53
128 EXT_SUPER_MAGIC 0x137D
129 EXT2_OLD_SUPER_MAGIC 0xEF51
130 EXT2_SUPER_MAGIC 0xEF53
131 EXT3_SUPER_MAGIC 0xEF53
132 EXT4_SUPER_MAGIC 0xEF53
133 HFS_SUPER_MAGIC 0x4244
134 HPFS_SUPER_MAGIC 0xF995E849
135 HUGETLBFS_MAGIC 0x958458f6
136 ISOFS_SUPER_MAGIC 0x9660
137 JFFS2_SUPER_MAGIC 0x72b6
138 JFS_SUPER_MAGIC 0x3153464a
139 .\"O MINIX_SUPER_MAGIC 0x137F /* orig. minix */
140 MINIX_SUPER_MAGIC 0x137F /* オリジナルの minix */
141 .\"O MINIX_SUPER_MAGIC2 0x138F /* 30 char minix */
142 MINIX_SUPER_MAGIC2 0x138F /* 30 文字ファイル名の minix */
143 MINIX2_SUPER_MAGIC 0x2468 /* minix V2 */
144 .\"O MINIX2_SUPER_MAGIC2 0x2478 /* minix V2, 30 char names */
145 MINIX2_SUPER_MAGIC2 0x2478 /* minix V2, 30 文字ファイル名 */
146 MSDOS_SUPER_MAGIC 0x4d44
147 NCP_SUPER_MAGIC 0x564c
148 NFS_SUPER_MAGIC 0x6969
149 NTFS_SB_MAGIC 0x5346544e
150 OPENPROM_SUPER_MAGIC 0x9fa1
151 PROC_SUPER_MAGIC 0x9fa0
152 QNX4_SUPER_MAGIC 0x002f
153 REISERFS_SUPER_MAGIC 0x52654973
155 SMB_SUPER_MAGIC 0x517B
156 SYSV2_SUPER_MAGIC 0x012FF7B6
157 SYSV4_SUPER_MAGIC 0x012FF7B5
158 TMPFS_MAGIC 0x01021994
159 UDF_SUPER_MAGIC 0x15013346
161 USBDEVICE_SUPER_MAGIC 0x9fa2
162 VXFS_SUPER_MAGIC 0xa501FCF5
163 XENIX_SUPER_MAGIC 0x012FF7B4
164 XFS_SUPER_MAGIC 0x58465342
165 _XIAFS_SUPER_MAGIC 0x012FD16D
169 .\"O Nobody knows what
171 .\"O is supposed to contain (but see below).
173 にどんな値が入るべきなのかは誰も知らない (但し、下記を参照)。
175 .\"O Fields that are undefined for a particular file system are set to 0.
177 .\"O returns the same information about an open file referenced by descriptor
179 それぞれのファイル・システムにおいて未定義のフィールドには 0 が
184 によって参照されるオープンされたファイルについて、同じ情報を返す。
185 .\"O .SH "RETURN VALUE"
187 .\"O On success, zero is returned.
188 .\"O On error, \-1 is returned, and
190 .\"O is set appropriately.
191 成功すれば 0 が返される。エラーの場合は \-1 が返され、
198 .\"O .RB ( statfs ())
199 .\"O Search permission is denied for a component of the path prefix of
204 のディレクトリ部分に検索許可が与えられていない
206 .\"O .BR path_resolution (7).)
207 .RB ( path_resolution (7)
211 .\"O .RB ( fstatfs ())
213 .\"O is not a valid open file descriptor.
217 は有効なオープンされたファイル・ディスクリプターではない。
223 .\"O points to an invalid address.
230 .\"O This call was interrupted by a signal.
234 .\"O An I/O error occurred while reading from the file system.
235 ファイル・システムの読み込みの間に I/O エラーが発生した。
238 .\"O .RB ( statfs ())
239 .\"O Too many symbolic links were encountered in translating
244 を解決するのに辿るべきシンボリック・リンクが多すぎる。
247 .\"O .RB ( statfs ())
256 .\"O .RB ( statfs ())
257 .\"O The file referred to by
266 .\"O Insufficient kernel memory was available.
270 .\"O The file system does not support this call.
271 ファイル・システムがこの呼び出しをサポートしていない。
274 .\"O .RB ( statfs ())
275 .\"O A component of the path prefix of
277 .\"O is not a directory.
284 .\"O Some values were too large to be represented in the returned struct.
285 値が大き過ぎるため、返り値の構造体で表現できない。
286 .\"O .SH "CONFORMING TO"
291 .\"O was inspired by the 4.4BSD one
292 .\"O (but they do not use the same structure).
296 は 4.4BSD のものに影響を受けている。
297 (しかし同じ構造体を使用しているわけではない)
300 .\"O The kernel has system calls
303 .\"O .BR statfs64 (),
305 .\"O .BR fstatfs64 ()
306 .\"O to support this library call.
315 .\"O Some systems only have \fI<sys/vfs.h>\fP, other systems also have
316 .\"O \fI<sys/statfs.h>\fP, where the former includes the latter.
318 .\"O including the former is the best choice.
319 \fI<sys/vfs.h>\fP しか持たないシステムもあり、
320 \fI<sys/statfs.h>\fP も持っているシステムもある。
322 前者をインクルードするのが良いと考えられる。
324 .\"O LSB has deprecated the library calls
328 .\"O and tells us to use
331 .\"O .BR fstatvfs (2)
340 .\"O .SS The f_fsid field
342 .\"O Solaris, Irix and POSIX have a system call
345 .\"O .I "struct statvfs"
347 .\"O .IR <sys/statvfs.h> )
349 .\"O .I "unsigned long"
351 Solaris, Irix, POSIX にはシステムコール
356 .RI ( <sys/statvfs.h>
362 .\"O Linux, SunOS, HP-UX, 4.4BSD have a system call
365 .\"O .I "struct statfs"
367 .\"O .IR <sys/vfs.h> )
374 .\"O .IR "struct { int val[2]; }" .
375 Linux, SunOS, HP-UX, 4.4BSD にはシステムコール
388 .I "struct { int val[2]; }"
390 .\"O The same holds for FreeBSD, except that it uses the include file
391 .\"O .IR <sys/mount.h> .
392 FreeBSD でも同じであるが、インクルードファイル
396 .\"O The general idea is that
398 .\"O contains some random stuff such that the pair
399 .\"O .RI ( f_fsid , ino )
400 .\"O uniquely determines a file.
404 という 1 組の値でファイルを一意に決定できるようにする、
406 .\"O Some operating systems use (a variation on) the device number, or the device number
407 .\"O combined with the file-system type.
408 いくつかの OS では、デバイス番号 (の変種) を使ったり、
409 デバイス番号とファイル・システムタイプを組み合わせて使ったりしている。
410 .\"O Several OSes restrict giving out the
412 .\"O field to the superuser only (and zero it for unprivileged users),
413 .\"O because this field is used in the filehandle of the file system
414 .\"O when NFS-exported, and giving it out is a security concern.
417 フィールドの取得をスーパーユーザに限定しているものもある
418 (非特権ユーザが取得すると 0 となる)。
420 このフィールドがファイル・システムのファイルハンドルで使われており、
421 この値を提供するとセキュリティ上の問題がある。
423 .\"O Under some operating systems the
425 .\"O can be used as second argument to the
432 システムコールの第 2 引き数として使用できる。
437 .BR path_resolution (7)