statfs(2)
NAME
statfs, fstatfs − get file system statistics
SYNOPSIS
#include <sys/vfs.h>
int statfs(const char *path, struct statfs *buf);
int fstatfs(int fildes, struct statfs *buf);
DESCRIPTION
statfs() returns information about a mounted file system. path is the path name of any file within the mounted file system.
buf is a pointer to a statfs() structure into which information is placed concerning the file system. The contents of the structure pointed to by buf include the following members:
long f_bavail; /* free blocks available to non-superuser */
long f_bfree; /* free blocks */
long f_blocks; /* total blocks in file system */
long f_bsize; /* fundamental file system block size in bytes */
long f_ffree; /* free file nodes in file system */
long f_files; /* total file nodes in file system */
long f_type; /* type of info, zero for now */
fsid_t f_fsid /* file system ID. f_fsid[1] is MOUNT_UFS,
MOUNT_NFS, or MOUNT_CDFS */
A file node is a structure in the file system hierarchy that describes a file. For mounted HP-UX volumes, file node is an HP-UX inode. For other types of mounts, file node is defined by the system embodying the file pointed to by path.
Fields that are undefined for a particular file system are set to −1.
fstatfs() returns similar information about an open file referred to by file descriptor fildes.
RETURN VALUE
statfs() and fstatfs() return 0 upon successful completion; otherwise, they return −1 and set errno to indicate the error.
ERRORS
statfs() fails if any of the following conditions are encountered:
[EACCES] Search permission is denied for a component of the path prefix.
[EFAULT] buf or path points to an invalid address.
[EIO] An I/O error occurred while reading from or writing to the file system.
[ELOOP] Too many symbolic links are encountered in translating the path name.
[ENAMETOOLONG] A component of path exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect, or path exceeds PATH_MAX bytes.
[ENOENT] The named file does not exist.
[ENOTDIR] A component of the path prefix is not a directory.
fstatfs() fails if any of the following conditions are encountered:
[EBADF] fildes is not a valid open file descriptor.
[EFAULT] buf points to an invalid address.
[EIO] An I/O error occurs while reading from or writing to the file system.
AUTHOR
statfs() and fstatfs() were developed by Sun Microsystems, Inc.
SEE ALSO
Hewlett-Packard Company — HP-UX Release 9.10: April 1995