[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    ustat(2) manual page Table of Contents

Name

ustat - get file system statistics

Synopsis


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

int ustat(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 (see makedev(3C) ). buf is a pointer to a ustat() structure that includes the following elements:


daddr_t    f_tfree;    /* Total free blocks */
ino_t    f_tinode;    /* Number of free inodes */
char    f_fname[6];    /* Filsys name */
char    f_fpack[6];    /* Filsys pack name */

The last two fields, f_fname and f_fpack may not have significant information on all systems, and in that case, will contain the null character as the first character of these fields.

Return Values

Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.

Errors

ustat() fails if one or more of the following are true:

ECOMM
dev is on a remote machine and the link to that machine is no longer active.
EFAULT
buf points to an illegal address.
EINTR
A signal was caught during a ustat() function.
EINVAL
dev is not the device number of a device containing a mounted file system.
ENOLINK
dev is on a remote machine and the link to that machine is no longer active.

See Also

stat(2) , statvfs(2) , makedev(3C)

Notes

ustat() will be phased out in favor of the statvfs(2) function.

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.


Table of Contents