The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


fstatvfs, statvfs - get file system information


#include <sys/statvfs.h>

int fstatvfs(int fildes, struct statvfs *buf);
int statvfs(const char *path, struct statvfs *buf);


The fstatvfs() function obtains information about the file system containing the file referenced by fildes.

The following flags can be returned in the f_flag member:

Read-only file system.
Setuid/setgid bits ignored by exec.

The statvfs() function obtains descriptive information about the file system containing the file named by path.

For both functions, the buf argument is a pointer to a statvfs structure that will be filled. 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.

It is unspecified whether all members of the statvfs structure have meaningful values on all file systems.


Upon successful completion, statvfs() returns 0. Otherwise, it returns -1 and sets errno to indicate the error.


The fstatvfs() and statvfs() functions will fail if:
An I/O error occurred while reading the file system.
A signal was caught during execution of the function.
One of the values to be returned cannot be represented correctly in the structure pointed to by buf.

The fstatvfs() function will fail if:

The fildes argument is not an open file descriptor.

The statvfs() function will fail if:

Search permission is denied on a component of the path prefix.
Too many symbolic links were encountered in resolving path.
The length of a pathname exceeds {PATH_MAX}, or a pathname component is longer than {NAME_MAX}.
A component of path does not name an existing file or path is an empty string.
A component of the path prefix of path is not a directory.

The statvfs() function may fail if:

Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}.








chmod(), chown(), creat(), dup(), exec, fcntl(), link(), mknod(), open(), pipe(), read(), time(), unlink(), utime(), write(), <sys/statvfs.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]