版權所有 © 2014 tutorialspoint
int statvfs(const char *path, struct statvfs *buf); int fstatvfs(int fd, struct statvfs *buf);
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定義的位是:
返回的結構的所有成員在所有檔案系統上是否具有有意義的值是不確定的。
fstatvfs()返回有關由描述符fd引用的開啟檔案的相同資訊。
當前的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欄位。
statfs (2)
廣告