BSD 4_4 development
[unix-history] / usr / share / man / cat2 / fstatfs.0
STATFS(2) BSD Programmer's Manual STATFS(2)
N\bNA\bAM\bME\bE
s\bst\bta\bat\btf\bfs\bs - get file system statistics
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmo\bou\bun\bnt\bt.\b.h\bh>\b>
_\bi_\bn_\bt
s\bst\bta\bat\btf\bfs\bs(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bp_\ba_\bt_\bh, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf);
_\bi_\bn_\bt
f\bfs\bst\bta\bat\btf\bfs\bs(_\bi_\bn_\bt _\bf_\bd, _\bs_\bt_\br_\bu_\bc_\bt _\bs_\bt_\ba_\bt_\bf_\bs _\b*_\bb_\bu_\bf);
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
S\bSt\bta\bat\btf\bfs\bs() returns information about a mounted file system. _\bP_\ba_\bt_\bh is the
path name of any file within the mounted filesystem. _\bB_\bu_\bf is a pointer to
a s\bst\bta\bat\btf\bfs\bs() structure defined as follows:
typedef quad fsid_t;
#define MNAMELEN 32 /* length of buffer for returned name */
struct statfs {
short f_type; /* type of filesystem (see below) */
short f_flags; /* copy of mount flags */
long f_bsize; /* fundamental file system block size */
long f_iosize; /* optimal transfer block size */
long f_blocks; /* total data blocks in file system */
long f_bfree; /* free blocks in fs */
long f_bavail; /* free blocks avail to non-superuser */
long f_files; /* total file nodes in file system */
long f_ffree; /* free file nodes in fs */
fsid_t f_fsid; /* file system id */
long f_spare[6]; /* spare for later */
char f_mntonname[MNAMELEN]; /* mount point */
char f_mntfromname[MNAMELEN]; /* mounted filesystem */
};
/*
* File system types.
*/
#define MOUNT_UFS 1
#define MOUNT_NFS 2
#define MOUNT_MFS 3
#define MOUNT_PC 4
Fields that are undefined for a particular file system are set to -1.
F\bFs\bst\bta\bat\btf\bfs\bs() returns the same information about an open file referenced by
descriptor _\bf_\bd.
R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
Upon successful completion, a value of 0 is returned. Otherwise, -1 is
returned and the global variable _\be_\br_\br_\bn_\bo is set to indicate the error.
E\bER\bRR\bRO\bOR\bRS\bS
S\bSt\bta\bat\btf\bfs\bs() fails if one or more of the following are true:
[ENOTDIR] A component of the path prefix of _\bP_\ba_\bt_\bh is not a directory.
[EINVAL] _\bp_\ba_\bt_\bh contains a character with the high-order bit set.
[ENAMETOOLONG]
The length of a component of _\bp_\ba_\bt_\bh exceeds 255 characters,
or the length of _\bp_\ba_\bt_\bh exceeds 1023 characters.
[ENOENT] The file referred to by _\bp_\ba_\bt_\bh does not exist.
[EACCES] Search permission is denied for a component of the path
prefix of _\bp_\ba_\bt_\bh.
[ELOOP] Too many symbolic links were encountered in translating
_\bp_\ba_\bt_\bh.
[EFAULT] _\bB_\bu_\bf or _\bp_\ba_\bt_\bh points to an invalid address.
[EIO] An I/O error occurred while reading from or writing to the
file system.
F\bFs\bst\bta\bat\btf\bfs\bs() fails if one or both of the following are true:
[EBADF] _\bF_\bd is not a valid open file descriptor.
[EFAULT] _\bB_\bu_\bf points to an invalid address.
[EIO] An I/O error occurred while reading from or writing to the
file system.
H\bHI\bIS\bST\bTO\bOR\bRY\bY
The s\bst\bta\bat\btf\bfs\bs function first appeared in 4.4BSD.
4.4BSD June 9, 1993 2