statvfs, fstatvfs, statvfs64, or fstatvfs64 Subroutine

Purpose

Returns information about a file system.

Library

Standard C Library (libc.a)

Syntax

#include <sys/statvfs.h>

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

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

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

int fstatvfs64 ( Fildes, Buf)
int Fildes;
struct statvfs64 *Buf;

Description

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.

The statvfs64 and fstatvfs64 subroutines are similar to the statvfs and fstatvfs subroutines except that the returned information is in the format of a statvfs64 structure instead of a statvfs structure.

The statvfs64 structure provides invariant 64-bit fields for the file system blocks (or inodes) sizes and counts, and the file system ID. This structure allows statvfs64 and fstatvfs64 to always return the specified information in invariant 64-bit values.

Parameters

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

Return Values

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

Error Codes

Item Description
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.