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 .\" Modified 2003-08-17 by Walter Harms
26 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
28 .\"*******************************************************************
30 .\" This file was generated with po4a. Translate the source file.
32 .\"*******************************************************************
34 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
35 .\" all rights reserved.
36 .\" Translated Fri Dec 12 00:25:54 JST 1997
37 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
38 .\" Updated & Modified Sat Jun 2 20:25:46 JST 2001
39 .\" by Yuichi SATO <ysato@h4.dion.ne.jp>
40 .\" Updated & Modified Sat Jan 18 16:48:08 JST 2003
41 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
42 .\" Updated & Modified Sun Sep 7 00:52:44 JST 2003 by Yuichi SATO
43 .\" Updated & Modified Sun Jan 9 22:35:28 JST 2005 by Yuichi SATO
44 .\" Updated 2006-07-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
45 .\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
47 .TH STATFS 2 2010\-11\-21 Linux "Linux Programmer's Manual"
49 statfs, fstatfs \- get filesystem statistics
51 \fB#include <sys/vfs.h> \fP/* または <sys/statfs.h> */
53 \fBint statfs(const char *\fP\fIpath\fP\fB, struct statfs *\fP\fIbuf\fP\fB);\fP
55 \fBint fstatfs(int \fP\fIfd\fP\fB, struct statfs *\fP\fIbuf\fP\fB);\fP
57 The function \fBstatfs\fP() returns information about a mounted filesystem.
58 \fIpath\fP is the pathname of any file within the mounted filesystem. \fIbuf\fP
59 is a pointer to a \fIstatfs\fP structure defined approximately as follows:
63 #if __WORDSIZE == 32 /* システムのワードサイズ */
64 # define __SWORD_TYPE int
65 #else /* __WORDSIZE == 64 */
66 # define __SWORD_TYPE long int
70 __SWORD_TYPE f_type; /* type of filesystem (see below) */
71 __SWORD_TYPE f_bsize; /* optimal transfer block size */
72 fsblkcnt_t f_blocks; /* total data blocks in filesystem */
73 fsblkcnt_t f_bfree; /* free blocks in fs */
74 fsblkcnt_t f_bavail; /* free blocks available to
76 fsfilcnt_t f_files; /* total file nodes in filesystem */
77 fsfilcnt_t f_ffree; /* free file nodes in fs */
78 fsid_t f_fsid; /* filesystem id */
79 __SWORD_TYPE f_namelen; /* maximum length of filenames */
80 __SWORD_TYPE f_frsize; /* fragment size (since Linux 2.6) */
81 __SWORD_TYPE f_spare[5];
86 ADFS_SUPER_MAGIC 0xadf5
87 AFFS_SUPER_MAGIC 0xADFF
88 BEFS_SUPER_MAGIC 0x42465331
90 CIFS_MAGIC_NUMBER 0xFF534D42
91 CODA_SUPER_MAGIC 0x73757245
92 COH_SUPER_MAGIC 0x012FF7B7
93 CRAMFS_MAGIC 0x28cd3d45
94 DEVFS_SUPER_MAGIC 0x1373
95 EFS_SUPER_MAGIC 0x00414A53
96 EXT_SUPER_MAGIC 0x137D
97 EXT2_OLD_SUPER_MAGIC 0xEF51
98 EXT2_SUPER_MAGIC 0xEF53
99 EXT3_SUPER_MAGIC 0xEF53
100 EXT4_SUPER_MAGIC 0xEF53
101 HFS_SUPER_MAGIC 0x4244
102 HPFS_SUPER_MAGIC 0xF995E849
103 HUGETLBFS_MAGIC 0x958458f6
104 ISOFS_SUPER_MAGIC 0x9660
105 JFFS2_SUPER_MAGIC 0x72b6
106 JFS_SUPER_MAGIC 0x3153464a
107 MINIX_SUPER_MAGIC 0x137F /* オリジナルの minix */
108 MINIX_SUPER_MAGIC2 0x138F /* 30 文字ファイル名の minix */
109 MINIX2_SUPER_MAGIC 0x2468 /* minix V2 */
110 MINIX2_SUPER_MAGIC2 0x2478 /* minix V2, 30 文字ファイル名 */
111 MSDOS_SUPER_MAGIC 0x4d44
112 NCP_SUPER_MAGIC 0x564c
113 NFS_SUPER_MAGIC 0x6969
114 NTFS_SB_MAGIC 0x5346544e
115 OPENPROM_SUPER_MAGIC 0x9fa1
116 PROC_SUPER_MAGIC 0x9fa0
117 QNX4_SUPER_MAGIC 0x002f
118 REISERFS_SUPER_MAGIC 0x52654973
120 SMB_SUPER_MAGIC 0x517B
121 SYSV2_SUPER_MAGIC 0x012FF7B6
122 SYSV4_SUPER_MAGIC 0x012FF7B5
123 TMPFS_MAGIC 0x01021994
124 UDF_SUPER_MAGIC 0x15013346
126 USBDEVICE_SUPER_MAGIC 0x9fa2
127 VXFS_SUPER_MAGIC 0xa501FCF5
128 XENIX_SUPER_MAGIC 0x012FF7B4
129 XFS_SUPER_MAGIC 0x58465342
130 _XIAFS_SUPER_MAGIC 0x012FD16D
134 \fIf_fsid\fP にどんな値が入るべきなのかは誰も知らない (但し、下記を参照)。
136 Fields that are undefined for a particular filesystem are set to 0.
137 \fBfstatfs\fP() returns the same information about an open file referenced by
140 成功した場合、0 が返される。 失敗した場合、 \-1 が返され、 \fIerrno\fP に適切な値がセットされる。
144 (\fBstatfs\fP() の場合) \fIpath\fP のディレクトリ部分に検索許可が与えられていない (\fBpath_resolution\fP(7)
148 (\fBfstatfs\fP() の場合) \fIfd\fP は有効なオープンされたファイルディスクリプターではない。
151 \fIbuf\fP または \fIpath\fP が不正なアドレスを指している。
157 An I/O error occurred while reading from the filesystem.
160 (\fBstatfs\fP() の場合) \fIpath\fP を解決するのに辿るべきシンボリックリンクが多すぎる。
163 (\fBstatfs\fP() の場合) \fIpath\fP が長過ぎる。
166 (\fBstatfs\fP() の場合) \fIpath\fP によって参照されるファイルが存在しない。
172 The filesystem does not support this call.
175 (\fBstatfs\fP() の場合) \fIpath\fP のディレクトリ部分がディレクトリでない。
178 いくつかの値が大き過ぎて、返り値の構造体で表現できない。
180 Linux 固有である。 Linux の \fBstatfs\fP() は 4.4BSD のものに影響を受けている。
181 (しかし同じ構造体を使用しているわけではない)
183 元々の Linux の \fBstatfs\fP() と \fBfstatfs\fP() システムコールは
184 非常に大きなファイルサイズを念頭に入れて設計されていなかった。
185 その後、Linux 2.6 で、新しい構造体 \fIstatfs64\fP を使用する
186 新しいシステムコール \fBstatfs64\fP() と \fBfstatfs64\fP() が追加された。
187 新しい構造体は元の \fIstatfs\fP 構造体と同じフィールドを持つが、
188 いろいろなフィールドのサイズが大きなファイルサイズに対応できるように
189 増やされている。 glibc の \fBstatfs\fP() と \fBfstatfs\fP() のラッパー関数は
190 カーネルによるこれらの違いを吸収している。
192 \fI<sys/vfs.h>\fP しか持たないシステムもあり、 \fI<sys/statfs.h>\fP
193 も持っているシステムもある。 前者は後者をインクルードするので、 前者をインクルードするのが良いと考えられる。
195 LSB ではライブラリコール \fBstatfs\fP(), \fBfstatfs\fP() を非推奨として、代わりに \fBstatvfs\fP(2),
196 \fBfstatvfs\fP(2) を使うように指示している。
198 Solaris, Irix, POSIX にはシステムコール \fBstatvfs\fP(2) があり、 \fIstruct statvfs\fP を返す
199 (\fI<sys/statvfs.h>\fP で定義されている)。 この構造体には、 \fIunsigned long\fP \fIf_fsid\fP
200 が含まれている。 Linux, SunOS, HP\-UX, 4.4BSD にはシステムコール \fBstatfs\fP() があり、 \fIstruct
201 statfs\fP を返す (\fI<sys/vfs.h>\fP で定義されている)。 この構造体には \fIfsid_t\fP \fIf_fsid\fP,
202 が含まれており、 \fIfsid_t\fP は \fIstruct { int val[2]; }\fP と定義されている。 FreeBSD
203 でも同じであるが、インクルードファイル \fI<sys/mount.h>\fP を使う。
205 The general idea is that \fIf_fsid\fP contains some random stuff such that the
206 pair (\fIf_fsid\fP,\fIino\fP) uniquely determines a file. Some operating systems
207 use (a variation on) the device number, or the device number combined with
208 the filesystem type. Several OSes restrict giving out the \fIf_fsid\fP field
209 to the superuser only (and zero it for unprivileged users), because this
210 field is used in the filehandle of the filesystem when NFS\-exported, and
211 giving it out is a security concern.
213 いくつかの OS では、 \fIfsid\fP を \fBsysfs\fP(2) システムコールの第 2 引き数として使用できる。
215 \fBstat\fP(2), \fBstatvfs\fP(2), \fBpath_resolution\fP(7)
217 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
218 である。プロジェクトの説明とバグ報告に関する情報は
219 http://www.kernel.org/doc/man\-pages/ に書かれている。