標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
z/OS® UNIX | 両方 |
#include <sys/statfs.h>
int w_statfs(const char *filesystem, struct w_statfs *statbuf, size_t length);
バッファー長がゼロの場合には、戻り値だけが戻されます。プロセスはゼロの長さを使用して、ファイル・システムが存在して いるかどうかを検出できます。
XPG4.2 の特殊な動作: w_statfs() は w_statvfs() によって置き換えられます。
正常に実行された場合、w_statfs() はデータの長さを バッファーに戻します。
⁄* CELEBW36 *⁄
#define _OPEN_SYS
#include <sys⁄statfs.h>
#include <stdio.h>
main() {
char fs[]="POSIX.ROOT.FS";
struct w_statfs buf;
if (w_statfs(fs, &buf, sizeof(buf)) == -1)
perror("w_statfs() error");
else {
printf("each block in %s is %d bytes big¥n", fs,
buf.statfs_blksize);
printf("there are %d blocks in use out of a total of %d¥n",
buf.statfs_used_space, buf.statfs_total_space);
printf("in bytes, that's %.0f bytes used out of a total of %.0f¥n",
((double)buf.statfs_used_space * buf.statfs_blksize),
((double)buf.statfs_total_space * buf.statfs_blksize));
}
}
each block in POSIX.ROOT.FS is 4096 bytes big
there are 2089 blocks in use out of a total of 2400
in bytes, that's 8556544 bytes used out of a total of 9830400