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:
- ST_RDONLY
- Read-only file system.
- ST_NOSUID
- 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:
- [EIO]
- An I/O error occurred while reading the file system.
- [EINTR]
- A signal was caught during execution of the function.
- [EOVERFLOW]
- One of the values to be returned cannot be represented correctly in the structure pointed to by buf.
The fstatvfs() function will fail if:
- [EBADF]
- The fildes argument is not an open file descriptor.
The statvfs() function will fail if:
- [EACCES]
- Search permission is denied on a component of the path prefix.
- [ELOOP]
- Too many symbolic links were encountered in resolving path.
- [ENAMETOOLONG]
- The length of a pathname exceeds {PATH_MAX}, or a pathname component is longer than {NAME_MAX}.
- [ENOENT]
- A component of path does not name an existing file or path is an empty string.
- [ENOTDIR]
- A component of the path prefix of path is not a directory.
The statvfs() function may fail if:
- [ENAMETOOLONG]
- Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}.
None.
None.
None.
chmod(), chown(), creat(), dup(), exec, fcntl(), link(), mknod(), open(), pipe(), read(), time(), unlink(), utime(), write(), <sys/statvfs.h>.