Go to the previous, next section.
int fstatfs(int fd, struct statfs *buf);
int statfs(char *path, struct statfs *buf);
fd: [in] the file descriptor we want to get the information from.
path: [in] the file path we want to get the information from.
buf: [out] points to the buffer that will contain the information.
Those calls return information about the file systems on which the files fd or path resides. The buffer has the following format:
struct statfs { long f_type; /* file system type */ long f_bsize; /* block size */ long f_blocks; /* total number of blocks */ long f_bfree; /* total number of free blocks */ long f_bavail; /* number of free blocks for normal user */ long f_files; /* number of file nodes */ long f_ffree; /* number of free file nodes */ fsid_t f_fsid; /* file system id */ long f_namelen; /* maximum file name length */ long f_spare[6]; /* unused */ };
On success zero is returned. On error, -1 is returned and errno
is
set to one of the following values:
In the case of fstatfs
:
EBADFS
, EFAULT
, ENOSYS
or EIO
.
In the case of statfs
:
EINVAL
: path contains a caracter outside the ASCII 0-127 range.
ENOTDIR
, ENAMETOOLONG
, ENOENT
,
EACCESS
, ELOOP
, EFAULT
, ENOSYS
or EIO
.
Go to the previous, next section.