Go to the previous, next section.

fstatfs and statfs

SYNOPSIS

int fstatfs(int fd, struct statfs *buf);

int statfs(char *path, struct statfs *buf);

PARAMETERS

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.

DESCRIPTION

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 */
};

RETURN VALUE

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:

In the case of statfs:

Go to the previous, next section.