[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

statvfs or fstatvfs Subroutine


Returns information about a file system.


Standard C Library (libc.a)


#include <sys/statvfs.h>

int statvfs ( Path, Buf)
const char *Path;
struct statvfs *Buf;

int fstatvfs ( Fildes, Buf)
int Fildes;
struct statvfs *Buf;


The statvfs and fstatvfs subroutines return descriptive information about a mounted file system containing the file referenced by the Path or Fildes parameters. The Buf parameter is a pointer to a structure which will by filled by the subroutine call.

The Path and Fildes parameters must reference a file which resides on the file system. Read, write, or execute permission of the named file is not required, but all directories listed in the pathname leading to the file must be searchable.


Path The path name identifying the file.
Buf A pointer to a statvfs structure in which information is returned. The statvfs structure is described in the sys/statvfs.h header file.
Fildes The file descriptor identifying the open file.

Return Values

0 Successful completion.
-1 Not successful and errno set to one of the following.

Error Codes

EACCES Search permission is denied on a component of the path.
EBADF The file referred to by the Fildes parameter is not an open file descriptor.
EIO An I/O error occurred while reading from the filesystem.
ELOOP Too many symbolic links encountered in translating path.
ENAMETOOLONG The length of the pathname exceeds PATH_MAX, or name component is longer than NAME_MAX.
ENOENT The file referred to by the Path parameter does not exist.
ENOMEM A memory allocation failed during information retrieval.
ENOTDIR A component of the Path parameter prefix is not a directory.
EOVERFLOW One of the values to be returned cannot be represented correctly in the structure pointed to by buf.

Related Information

The stat (statx, stat, lstat, fstatx, fstat, fullstat, ffullstat, stat64, lstat64, or fstat64 Subroutine) subroutine, statfs (statfs, fstatfs, or ustat Subroutine) subroutine.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]