, fstatvfs

Synopsis

Description

The statvfs() function returns a “generic superblock” describing a file system; it
can be used to acquire information about mounted file systems.
The buf argument is a pointer to a structure (described below) that
is filled by the function.

The path argument should name a file that resides on that file
system. The file system type is known to the operating system. Read,
write, or execute permission for the named file is not required, but
all directories listed in the path name leading to the file must be
searchable.

The statvfs structure pointed to by buf includes the following members:

The fstatvfs() function is similar to statvfs(), except that the file named
by path in statvfs() is instead identified by an open file descriptor
fildes obtained from a successful open(2), creat(2), dup(2), fcntl(2), or pipe(2) function
call.

The statvfs() function returns correct results for the total number of blocks
in the entire pool (total) and the number of available blocks within
a given file system (free). The equation “used = total -
free” will not work for ZFS file systems, due to the fact that
in pooled storage many file systems share the total available from the
entire storage pool.

Return Values

Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno
is set to indicate the error.

Errors

The statvfs() and fstatvfs() functions will fail if:

EOVERFLOW

One of the values to be returned cannot be represented correctly in the structure pointed to by buf.

The statvfs() function will fail if:

EACCES

Search permission is denied on a component of the path prefix.

EFAULT

The path or buf argument points to an illegal address.

EINTR

A signal was caught during the execution of the statvfs() function.

EIO

An I/O error occurred while reading the file system.

ELOOP

Too many symbolic links were encountered in translating path.

ENAMETOOLONG

The length of a path component exceeds NAME_MAX characters, or the length of path The exceeds PATH_MAX characters.

ENOENT

Either a component of the path prefix or the file referred to by path does not exist.

ENOLINK

The path argument points to a remote machine and the link to that machine is no longer active.

ENOTDIR

A component of the path prefix of path is not a directory.

The fstatvfs() function will fail if:

EBADF

The fildes argument is not an open file descriptor.

EFAULT

The buf argument points to an illegal address.

EINTR

A signal was caught during the execution of the fstatvfs() function.

EIO

An I/O error occurred while reading the file system.

Usage

The statvfs() and fstatvfs() functions have transitional interfaces for 64-bit file offsets.
See lf64(5).