.\" Copyright (C) 2003 Andries Brouwer (aeb@cwi.nl) .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" The pathconf note is from Walter Harms .\" This is not a system call on Linux .\" .\" Modified 2004-06-23 by Michael Kerrisk .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2004-2005 Yuichi SATO .\" all rights reserved. .\" Translated Tue Jun 29 23:36:41 JST 2004 .\" by Yuichi SATO .\" Updated & Modified Sun Jan 9 22:50:29 JST 2005 by Yuichi SATO .\" .TH STATVFS 3 2017\-09\-15 Linux "Linux Programmer's Manual" .SH 名前 statvfs, fstatvfs \- ファイルシステムの統計を取得する .SH 書式 \fB#include \fP .PP \fBint statvfs(const char *\fP\fIpath\fP\fB, struct statvfs *\fP\fIbuf\fP\fB);\fP .br \fBint fstatvfs(int \fP\fIfd\fP\fB, struct statvfs *\fP\fIbuf\fP\fB);\fP .SH 説明 関数 \fBstatvfs\fP() はマウントされたファイルシステムについての情報を返す。 \fIpath\fP はマウントされたファイルシステム中の任意のファイルのパス名である。 \fIbuf\fP は、だいたい以下のように定義されている \fIstatvfs\fP 構造体へのポインターである: .PP .in +4n .EX struct statvfs { unsigned long f_bsize; /* Filesystem block size */ unsigned long f_frsize; /* Fragment size */ fsblkcnt_t f_blocks; /* Size of fs in f_frsize units */ fsblkcnt_t f_bfree; /* Number of free blocks */ fsblkcnt_t f_bavail; /* Number of free blocks for unprivileged users */ fsfilcnt_t f_files; /* Number of inodes */ fsfilcnt_t f_ffree; /* Number of free inodes */ fsfilcnt_t f_favail; /* Number of free inodes for unprivileged users */ unsigned long f_fsid; /* Filesystem ID */ unsigned long f_flag; /* Mount flags */ unsigned long f_namemax; /* Maximum filename length */ }; .EE .in .PP ここで、型 \fIfsblkcnt_t\fP と \fIfsfilcnt_t\fP は \fI\fP で定義されている。 かつて、これらは共に \fIunsigned long\fP であった。 .PP .\" XXX Keep this list in sync with statfs(2) The field \fIf_flag\fP is a bit mask indicating various options that were employed when mounting this filesystem. It contains zero or more of the following flags: .TP \fBST_MANDLOCK\fP Mandatory locking is permitted on the filesystem (see \fBfcntl\fP(2)). .TP \fBST_NOATIME\fP Do not update access times; see \fBmount\fP(2). .TP \fBST_NODEV\fP Disallow access to device special files on this filesystem. .TP \fBST_NODIRATIME\fP Do not update directory access times; see \fBmount\fP(2). .TP \fBST_NOEXEC\fP Execution of programs is disallowed on this filesystem. .TP \fBST_NOSUID\fP The set\-user\-ID and set\-group\-ID bits are ignored by \fBexec\fP(3) for executable files on this filesystem .TP \fBST_RDONLY\fP This filesystem is mounted read\-only. .TP \fBST_RELATIME\fP Update atime relative to mtime/ctime; see \fBmount\fP(2). .TP \fBST_SYNCHRONOUS\fP Writes are synched to the filesystem immediately (see the description of \fBO_SYNC\fP in \fBopen\fP(2)). .PP 返された構造体の全てのメンバが全てのファイルシステムで 意味のある値であるか否かは、指定されていない。 .PP \fBfstatvfs\fP() は、ディスクリプター \fIfd\fP で参照されるオープンされたファイルについて、同じ情報を返す。 .SH 返り値 成功した場合、0 が返される。 失敗した場合、 \-1 が返され、 \fIerrno\fP に適切な値がセットされる。 .SH エラー .TP \fBEACCES\fP (\fBstatvfs\fP() の場合) \fIpath\fP のディレクトリ部分に検索許可が与えられていない (\fBpath_resolution\fP(7) も参照すること)。 .TP \fBEBADF\fP (\fBfstatvfs\fP() の場合) \fIfd\fP が有効なオープンファイルディスクリプターではない。 .TP \fBEFAULT\fP \fIbuf\fP または \fIpath\fP が無効なアドレスを指している。 .TP \fBEINTR\fP この呼び出しがシグナルで中断された。 \fBsignal\fP(7) 参照。 .TP \fBEIO\fP ファイルシステムからの読み込みの間に I/O エラーが発生した。 .TP \fBELOOP\fP (\fBstatvfs\fP() の場合) \fIpath\fP にシンボリックリンクが多すぎる。 .TP \fBENAMETOOLONG\fP (\fBstatvfs\fP() の場合) \fIpath\fP が長すぎる。 .TP \fBENOENT\fP (\fBstatvfs\fP() の場合) \fIpath\fP で参照されるファイルが存在しない。 .TP \fBENOMEM\fP 十分なカーネルメモリーがない。 .TP \fBENOSYS\fP ファイルシステムがこの呼び出しをサポートしていない。 .TP \fBENOTDIR\fP (\fBstatvfs\fP() の場合) \fIpath\fP のディレクトリ部分がディレクトリでない。 .TP \fBEOVERFLOW\fP いくつかの値が大き過ぎて、返り値の構造体で表現できない。 .SH 属性 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。 .TS allbox; lbw21 lb lb l l l. インターフェース 属性 値 T{ \fBstatvfs\fP(), \fBfstatvfs\fP() T} Thread safety MT\-Safe .TE .SH 準拠 POSIX.1\-2001, POSIX.1\-2008. .PP Only the \fBST_NOSUID\fP and \fBST_RDONLY\fP flags of the \fIf_flag\fP field are specified in POSIX.1. To obtain definitions of the remaining flags, one must define \fB_GNU_SOURCE\fP. .SH 注意 Linux カーネルには、このライブラリコールをサポートするために、 \fBstatfs\fP(2), \fBfstatfs\fP(2) システムコールがある。 .PP .\" glibc commit 3cdaa6adb113a088fdfb87aa6d7747557eccc58d In glibc versions before 2.13, \fBstatvfs\fP() populated the bits of the \fIf_flag\fP field by scanning the mount options shown in \fI/proc/mounts\fP. However, starting with Linux 2.6.36, the underlying \fBstatfs\fP(2) system call provides the necessary information via the \fIf_flags\fP field, and since glibc version 2.13, the \fBstatvfs\fP() function will use information from that field rather than scanning \fI/proc/mounts\fP. .PP The glibc implementations of .PP .in +4n .EX pathconf(path, _PC_REC_XFER_ALIGN); pathconf(path, _PC_ALLOC_SIZE_MIN); pathconf(path, _PC_REC_MIN_XFER_SIZE); .EE .in .PP respectively use the \fIf_frsize\fP, \fIf_frsize\fP, and \fIf_bsize\fP fields returned by a call to \fBstatvfs\fP() with the argument \fIpath\fP. .SH 関連項目 \fBstatfs\fP(2) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。