STATFS(2)

NAME
statfs - get file system statistics

SYNOPSIS
#include <sys/param.h>
#include <sys/mount.h>

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

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

DESCRIPTION
statfs returns information about a mounted file system. path is the path name of any file within the mounted filesystem. buf is a pointer to a statfs structure defined as follows:
typedef quad fsid_t;
struct statfs {
long	f_type;		/* FST type (see below) */
long	f_bsize;	/* fundamental file system block size */
long	f_blocks;	/* total data blocks in file system */
long	f_bfree;	/* free blocks in fs */
long	f_bavail;	/* free blocks avail to non-superuser */
long	f_files;	/* total file nodes in file system */
long	f_ffree;	/* free file nodes in fs */
fsid_t	f_fsid;		/* file system id (GS/OS device number) */
long	f_spare[7];	/* reserved */
}
/*
 * File system types.
 */
#define MOUNT_PRODOS	0x0001	/* ProDOS or SOS */
#define MOUNT_DOS_33	0x0002	/* DOS 3.3 */
#define MOUNT_DOS_32	0x0003	/* DOS 3.1 or 3.2 */
#define MOUNT_PASCAL	0x0004	/* Apple II Pascal */
#define MOUNT_MFS		0x0005	/* Macintosh (MFS) */
#define MOUNT_HFS		0x0006	/* Macintosh (HFS) */
#define MOUNT_LISA		0x0007	/* Lisa */
#define MOUNT_CPM		0x0008	/* Apple CP/M */
#define MOUNT_MSDOS		0x000A	/* MS/DOS */
#define MOUNT_HIGHS		0x000B	/* High Sierra */
#define MOUNT_CD9660	0x000C	/* ISO 9660 (CD-ROM) */
#define MOUNT_APLSHAR	0x000D	/* AppleShare */

Fields that are undefined for a particular file system are set to -1. fstatfs returns the same information about an open file referenced by descriptor fd.

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

HISTORY
The statfs function first appeared in 4.4BSD.