Unix-system-calls-fstatvfs
[top]#
|http://www.google.com/[Google] | a|
Web | This Site |
選択した読書
Copyright©2014 by finddevguides |
[cols=",,,,,,,",] |
| | Home | | References | | Discussion Forums | | About TP
[width="100%",cols="100%",] |
a| == statvfs()-Unix、Linuxシステムコール
[[File:]] image :http://www.finddevguides.com/images/next.gif [next] image:http://www.finddevguides.com/add- this.gif [AddThisソーシャルブックマークボタン]
広告
NAME
statvfs、fstatvfs-ファイルシステム統計を取得
概要
#include <sys/statvfs.h> int statvfs(const char* path, struct statvfs *buf); int fstatvfs(int fd, struct statvfs *buf); |
説明
関数 statvfs ()は、マウントされたファイルシステムに関する情報を返します。 _path_は、マウントされたファイルシステム内のファイルのパス名です。 _buf_は、およそ次のように定義された_statvfs_構造体へのポインターです。
struct statvfs { unsigned long f_bsize; /*file system block size*/ unsigned long f_frsize; /*fragment size*/ fsblkcnt_t f_blocks; /*size of fs in f_frsize units*/ fsblkcnt_t f_bfree; /*# free blocks*/ fsblkcnt_t f_bavail; /*# free blocks for non-root*/ fsfilcnt_t f_files; /*# inodes*/ fsfilcnt_t f_ffree; /*# free inodes*/ fsfilcnt_t f_favail; /*# free inodes for non-root*/ unsigned long f_fsid; /*file system ID*/ unsigned long f_flag; /*mount flags*/ unsigned long f_namemax; /*maximum filename length*/ }; |
ここで、タイプ fsblkcnt_t および fsfilcnt_t は_ <sys/types.h> _で定義されています。 両方とも_unsigned long_でした。
フィールド_f_flag_はビットマスクです(マウントフラグの、 mount (8)を参照)。 POSIXで定義されているビットは
Tag | Description |
---|---|
ST_RDONLY | Read-only file system. |
*ST_NOSUID * | Set-user-ID/set-group-ID bits are ignored by* exec*(2). |
返された構造体のすべてのメンバーがすべてのファイルシステムで意味のある値を持つかどうかは指定されていません。
*fstatvfs* ()は、記述子_fd_によって参照される開いているファイルに関する同じ情報を返します。
返り値
成功すると、ゼロが返されます。 エラーの場合、-1が返され、_errno_が適切に設定されます。
エラー
Error Code | Description |
---|---|
EACCES | (statvfs()) Search permission is denied for a component of the path prefix of path. (See also path_resolution(2).) |
EBADF | (fstatvfs()) fd is not a valid open file descriptor. |
EFAULT | Buf or path points to an invalid address. |
EINTR | This call was interrupted by a signal. |
EIO | An I/O error occurred while reading from the file system. |
ELOOP | (statvfs()) Too many symbolic links were encountered in translating path. |
ENAMETOOLONG | (statvfs()) path is too long. |
ENOENT | (statvfs()) The file referred to by path does not exist. |
ENOMEM | Insufficient kernel memory was available. |
ENOSYS | The file system does not support this call. |
ENOTDIR | (statvfs()) A component of the path prefix of path is not a directory. |
EOVERFLOW | Some values were too large to be represented in the returned struct. |
準拠
Solaris、Irix、POSIX.1-2001
ノート
Linuxカーネルには、このライブラリ呼び出しをサポートするシステム呼び出し statfs ()および fstatfs ()があります。
現在のglibcの実装
pathconf(path, _PC_REC_XFER_ALIGN); pathconf(path, _PC_ALLOC_SIZE_MIN); pathconf(path, _PC_REC_MIN_XFER_SIZE); |
statvfs(path、buf)_の戻り値の_f_frsize _、 f_frsize_、および_f_bsize_フィールドを使用します。
関連項目
[[File:]] image :http://www.finddevguides.com/images/next.gif [next] [[File:]]
広告
|
[cols="^",] |
|Advertisements