.TH statfs() "" "" "System Call (libc)"
.PC "Get information about a file system"
.B "#include <sys/types.h>"
.B "#include <sys/statfs.h>"
\fBint statfs (\fIpath\^\fB, \fIbuffer\^\fB, \fIlength\^\fB, \fIfstype\^\fB)\fR
\fBchar *\fIpath\^\fB;\fR
\fBstruct statfs *\fIbuffer\^\fB;\fR
\fBint \fIlength\^\fB, \fIfstype\^\fB;\fR
.PP
The \*(CO system call
.B statfs()
returns information about a file system, either mounted or unmounted.
.PP
.I buffer
points to a structure of type
.BR statfs ,
which contains the following members:
.DM
.ta 0.5i 1.5i 3.0i
	short	f_fstyp;	/* type of the file system */
	short	f_bsize;	/* block size */
	short	f_frsize;	/* fragment size */
	long	f_blocks;	/* number of blocks in the file system */
	long	f_bfree;	/* number of free blocks */
	long	f_files;	/* number of file nodes */
	long	f_ffree;	/* number of free file nodes */
	char	f_fname[6];	/* name of the volume */
	char	f_fpack[6];	/* name of the pack */
.DE
.PP
.I length
is the length of the area into which
.B statfs()
can write its output.
This should always be set to \fBsizeof(struct statfs)\fR.
.PP
.I path
and
.I fstype
identify the file system.
If the file system is unmounted, then
.I path
should name the device by which the file system is accessed, and
.I fstype
should contain the type of the file system.
If the file system is mounted, then
.I path
should give the full path name of a file on the file system in question, and
.I fstype
must be set to zero.
.PP
.B statfs()
returns zero if all went well.
If something went wrong, it returns \-1 and sets
.B errno
to an appropriate value.
.SH "See Also"
.Xr "fstatfs()," fstatfs
.Xr "libc," libc
.Xr "mkfs," mkfs
.Xr "statfs.h," statfs.h
.Xr "ustat()" ustat
