STATVFS(3) | Library Functions Manual | STATVFS(3) |
fstatvfs
, statvfs
— retrieve file system information
Standard C Library (libc, -lc)
#include
<sys/statvfs.h>
int
fstatvfs
(int fildes,
struct statvfs *buf);
int
statvfs
(const char *restrict
path, struct statvfs *restrict buf);
The
statvfs
()
and
fstatvfs
()
functions attempt to fill the structure pointed to by
buf with file system statistics, but portable
applications must not depend on this. Applications must pass a pathname or
file descriptor which refers to a file on the file system in which they are
interested.
The statvfs structure contains the following members:
In addition, there are three members of type fsfilcnt_t, which represent counts of file serial numbers (i.e., inodes); these are named f_files, f_favail, and f_ffree, and represent the number of file serial numbers which exist in total, are available to unprivileged processes, and are available to privileged processes, respectively. Likewise, the members f_blocks, f_bavail, and f_bfree (all of type fsblkcnt_t) represent the respective allocation-block counts.
There are two flags defined for the f_flag member:
The statvfs
() and
fstatvfs
() functions are implemented as wrappers
around the statfs
() and
fstatfs
() functions, respectively. Not all the
information provided by those functions is made available through this
interface.
The statvfs
() and
fstatvfs
() functions return the value 0 if
successful; otherwise the value -1 is returned and the global
variable errno is set to indicate the error.
The statvfs
() function fails if one or
more of the following are true:
EACCES
]EFAULT
]EIO
]ELOOP
]ENAMETOOLONG
]{NAME_MAX}
characters, or the length of
path exceeds {PATH_MAX}
characters.ENOENT
]ENOTDIR
]The fstatvfs
() functions fails if one or
more of the following are true:
The statvfs
() and
fstatvfs
() functions conform to
IEEE Std 1003.1-2001 (“POSIX.1”). As
standardized, portable applications cannot depend on these functions
returning any valid information at all. This implementation attempts to
provide as much useful information as is provided by the underlying file
system, subject to the limitations of the specified data types.
The statvfs
() and
fstatvfs
() manual page was originally written by
Garrett Wollman
⟨wollman@FreeBSD.org⟩.
July 13, 2002 | Mac OS X 12 |