USTAT(2)

NAME
ustat - get file system statistics

SYNOPSIS
#include <sys/types.h>
#include <ustat.h>

int ustat(dev, buf)
dev_t dev;
struct ustat *buf;

DESCRIPTION

ustat() returns information about a mounted file system. dev is a device number identifying a device containing a mounted file system. This is normally the value returned in the st_dev field of a stat structure when a stat(), fstat(), or lstat() call is made on a file on that file system. buf is a pointer to a ustat structure that includes the following elements:

    daddr_t	f_tfree;	/* Total blocks available to non-super-user */
    ino_t	f_tinode;	/* Number of free files */
    char	f_fname[6];	/* Filsys name */
    char	f_fpack[6];	/* Filsys pack name */

The f_fname and f_fpack fields are always set to a null string. Other fields that are undefined for a particular file system are set to -1.

RETURN VALUES

ustat() returns:

0   on success.

-1  on failure and sets errno to indicate the error.

ERRORS

EFAULT
    buf points to an invalid address.

EINVAL
    dev is not the device number of a device containing a mounted file system.

EIO An I/O error occurred while reading from or writing to the file system.

SEE ALSO
stat(2V), statfs(2)

BUGS

The NFS revision 2 protocol does not permit the number of free files to be provided to the client; thus, when ustat() is done on an NFS file system, f_tinode is always -1.