Filesystem Statistics System call

Functions

int statvfs(const char *path, struct statvfs *buf)

Get filesystem statistics The function returns information about a mounted filesystem

Parameters:
  • path – pathname of any file within the mounted filesystem

  • buf – a pointer to a statvfs structure

Returns:

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

int fstatvfs(int fd, struct statvfs *buf)

Get filesystem statistics fstatvfs() returns the same information returned by statvfs() about an open file referenced by descriptor.

Parameters:
  • fd – File descriptor

  • buf – a pointer to a statvfs structure

Returns:

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

Structures

struct statvfs

Filesystem information structure.

Enumerations

enum _f_flag_e

Definitions for the flag in f_flag

Values:

enumerator ST_RDONLY

Mount read-only

enumerator ST_NOSUID

Ignore suid and sgid bits

enumerator ST_NODEV

Disallow access to device special files.

enumerator ST_NOEXEC

Disallow program execution.

enumerator ST_SYNCHRONOUS

Writes are synced at once.

enumerator ST_MANDLOCK

Allow mandatory locks on an FS.

enumerator ST_WRITE

Write on file/directory/symlink.

enumerator ST_APPEND

Append-only file.

enumerator ST_IMMUTABLE

Immutable file.

enumerator ST_NOATIME

Do not update access times.

enumerator ST_NODIRATIME

Do not update directory access times.

enumerator ST_RELATIME

Update atime relative to mtime/ctime.