Rev | Author | # | Line |
---|---|---|---|
1 | perry | 1 | !!NAME |
2 | statfs, fstatfs - get file system statistics | ||
3 | !!SYNOPSIS | ||
4 | |||
2 | PerryLorier | 5 | __#include <sys/vfs.h>__ |
1 | perry | 6 | |
2 | PerryLorier | 7 | __int statfs(const char *__''path''__, struct statfs *__''buf''__);__ |
8 | __int fstatfs(int__ ''fd''__, struct statfs *__''buf''__);__ | ||
1 | perry | 9 | |
10 | !!DESCRIPTION | ||
2 | PerryLorier | 11 | statfs(2) returns information about a mounted file system. ''path'' is the path name of any file within the mounted filesystem. ''buf'' is a pointer to a ''statfs'' structure defined as follows: |
12 | struct statfs { | ||
13 | long f_type; /* type of filesystem (see below) */ | ||
14 | long f_bsize; /* optimal transfer block size */ | ||
15 | long f_blocks; /* total data blocks in file system */ | ||
16 | long f_bfree; /* free blocks in fs */ | ||
17 | long f_bavail; /* free blocks avail to non-superuser */ | ||
18 | long f_files; /* total file nodes in file system */ | ||
19 | long f_ffree; /* free file nodes in fs */ | ||
20 | fsid_t f_fsid; /* file system id */ | ||
21 | long f_namelen; /* maximum length of filenames */ | ||
22 | long f_spare[[6]; /* spare for later */ | ||
23 | }; | ||
1 | perry | 24 | |
25 | File system types: | ||
26 | linux/affs_fs.h: | ||
2 | PerryLorier | 27 | AFFS_SUPER_MAGIC 0xADFF |
1 | perry | 28 | linux/efs_fs.h: |
2 | PerryLorier | 29 | EFS_SUPER_MAGIC 0x00414A53 |
1 | perry | 30 | linux/ext_fs.h: |
2 | PerryLorier | 31 | EXT_SUPER_MAGIC 0x137D |
1 | perry | 32 | linux/ext2_fs.h: |
2 | PerryLorier | 33 | EXT2_OLD_SUPER_MAGIC 0xEF51 |
34 | EXT2_SUPER_MAGIC 0xEF53 | ||
1 | perry | 35 | linux/hpfs_fs.h: |
2 | PerryLorier | 36 | HPFS_SUPER_MAGIC 0xF995E849 |
1 | perry | 37 | linux/iso_fs.h: |
2 | PerryLorier | 38 | ISOFS_SUPER_MAGIC 0x9660 |
1 | perry | 39 | linux/minix_fs.h: |
2 | PerryLorier | 40 | MINIX_SUPER_MAGIC 0x137F /* orig. minix */ |
41 | MINIX_SUPER_MAGIC2 0x138F /* 30 char minix */ | ||
42 | MINIX2_SUPER_MAGIC 0x2468 /* minix V2 */ | ||
43 | MINIX2_SUPER_MAGIC2 0x2478 /* minix V2, 30 char names */ | ||
1 | perry | 44 | linux/msdos_fs.h: |
2 | PerryLorier | 45 | MSDOS_SUPER_MAGIC 0x4d44 |
1 | perry | 46 | linux/ncp_fs.h: |
2 | PerryLorier | 47 | NCP_SUPER_MAGIC 0x564c |
1 | perry | 48 | linux/nfs_fs.h: |
2 | PerryLorier | 49 | NFS_SUPER_MAGIC 0x6969 |
1 | perry | 50 | linux/proc_fs.h: |
2 | PerryLorier | 51 | PROC_SUPER_MAGIC 0x9fa0 |
1 | perry | 52 | linux/smb_fs.h: |
2 | PerryLorier | 53 | SMB_SUPER_MAGIC 0x517B |
1 | perry | 54 | linux/sysv_fs.h: |
2 | PerryLorier | 55 | XENIX_SUPER_MAGIC 0x012FF7B4 |
56 | SYSV4_SUPER_MAGIC 0x012FF7B5 | ||
57 | SYSV2_SUPER_MAGIC 0x012FF7B6 | ||
58 | COH_SUPER_MAGIC 0x012FF7B7 | ||
1 | perry | 59 | linux/ufs_fs.h: |
2 | PerryLorier | 60 | UFS_MAGIC 0x00011954 |
1 | perry | 61 | linux/xfs_fs.h: |
2 | PerryLorier | 62 | XFS_SUPER_MAGIC 0x58465342 |
1 | perry | 63 | linux/xia_fs.h: |
2 | PerryLorier | 64 | _XIAFS_SUPER_MAGIC 0x012FD16D |
1 | perry | 65 | |
2 | PerryLorier | 66 | Fields that are undefined for a particular file system are set to 0. fstatfs(2) returns the same information about an open file referenced by descriptor ''fd''. |
1 | perry | 67 | |
68 | !!RETURN VALUE | ||
2 | PerryLorier | 69 | On success, zero is returned. On error, -1 is returned, and ''errno'' is set appropriately. |
1 | perry | 70 | |
71 | !!ERRORS | ||
2 | PerryLorier | 72 | For statfs(2): |
73 | ;[ENOTDIR]: A component of the path prefix of ''path'' is not a directory. | ||
74 | ;[ENAMETOOLONG]: ''path'' is too long. | ||
75 | ;[ENOENT]: The file referred to by ''path'' does not exist. | ||
76 | ;[EACCES]: Search permission is denied for a component of the path prefix of ''path''. | ||
77 | ;[ELOOP]: Too many symbolic links were encountered in translating ''path''. | ||
78 | ;[EFAULT]: ''Buf'' or ''path'' points to an invalid address. | ||
79 | ;[EIO]: An I/O error occurred while reading from or writing to the file system. | ||
80 | ;[ENOMEM]: Insufficient kernel memory was available. | ||
81 | ;[ENOSYS]: The filesystem ''path'' is on does not support statfs(2). | ||
1 | perry | 82 | |
2 | PerryLorier | 83 | For fstatfs(2): |
3 | PerryLorier | 84 | ;[EBADF]: ''fd'' is not a valid open file descriptor. |
85 | ;[EFAULT]: ''buf'' points to an invalid address. | ||
86 | ;[EIO]: An I/O error occurred while reading from or writing to the file system. | ||
87 | ;[ENOSYS]: The filesystem ''fd'' is open on does not support statfs(2). | ||
1 | perry | 88 | |
89 | !!CONFORMING TO | ||
2 | PerryLorier | 90 | The Linux statfs(2) was inspired by the 4.4BSD one (but they do not use the same structure). |
1 | perry | 91 | |
92 | !!SEE ALSO | ||
2 | PerryLorier | 93 | stat(2), fstat(2), statfs(2) |
lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 8 times)