NAME [Toc] [Back]
statfs, fstatfs - get file system statistics
SYNOPSIS [Toc] [Back]
int statfs(const char *path, struct statfs *buf);
int fstatfs(int fildes, struct statfs *buf);
DESCRIPTION [Toc] [Back]
statfs() returns status information for a mounted file system.
fstatfs() returns similar information for an open file.
The parameters for the statfs() and fstatfs() functions are as
path is a pointer to a path name of any file within the
mounted file system.
buf is a pointer to a statfs structure, which is where the
file system status information is stored.
fildes is a file descriptor for an open file, which is created
with the successful completion of an open(), creat(),
dup(), fcntl(), or pipe() system call (see open(2),
creat(2), dup(2), fcntl(2), or pipe(2)).
The statfs structure contains the following members:
int32_t f_bavail; /* free blocks available to non-superuser */
int32_t f_bfree; /* free blocks */
int32_t f_blocks; /* total blocks in file system */
int32_t f_bsize; /* fundamental file system block size in bytes */
int32_t f_ffree; /* free file nodes in file system */
int32_t f_files; /* total file nodes in file system */
int32_t f_type; /* type of info, zero for now */
fsid_t f_fsid /* file system ID. f_fsid is the file system
type; see sysfs(2) */
The fields f_blocks , f_bavail and f_bfree are expressed in terms of
blocks of size f_bsize.
A file node is a structure in the file system hierarchy that describes
Fields that are undefined for a particular file system are set to -1.
RETURN VALUE [Toc] [Back]
statfs() and fstatfs() return 0 upon successful completion; otherwise,
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
they return -1 and set errno to indicate the error.
ERRORS [Toc] [Back]
If statfs() fails, errno is set to one of the following values:
[EACCES] Search permission is denied for a component
of the path prefix.
[EFAULT] buf or path point 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
during path-name translation.
[ENAMETOOLONG] The length of the specified path name
exceeds PATH_MAX bytes, or the length of a
component of the path name exceeds NAME_MAX
bytes while _POSIX_NO_TRUNC is in effect.
[ENOENT] The named file does not exist (for example,
path is null or a component of path does not
[ENOTDIR] A component of the path prefix is not a
[EOVERFLOW] Result would overflow one or more fields of
the statfs struct.
If fstatfs() fails, errno is set to one of the following values:
[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.
WARNINGS [Toc] [Back]
statfs() is deprecated and should be used only by legacy 32-bit
applications. statvfs() or statvfs64() are the recommended
AUTHOR [Toc] [Back]
statfs() and fstatfs() were developed by Sun Microsystems, Inc.
SEE ALSO [Toc] [Back]
df(1M), stat(2), statvfs(2), ustat(2).
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003 [ Back ]