.TH fstatfs() "" "" "System Call (libc)"
.PC "Get information about a file system"
.B "#include <sys/types.h>"
.B "#include <sys/statfs.h>"
\fBint fstatfs (\fIfiledes\^\fB, \fIbuffer\^\fB, \fIlength\^\fB, \fIfstype\^\fB)\fR
\fBint \fIfiledes\^\fB;\fR
\fBstruct statfs *\fIbuffer\^\fB;\fR
\fBint \fIlength\^\fB, \fIfstype\^\fB;\fR
.PP
The \*(CO system call
.B fstatfs()
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 2.5i
	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 fstatfs()
can write its output.
Always set this to \fBsizeof(struct statfs)\fR.
.PP
.I filedes
and
.I fstype
identify the file system.
If the file system is unmounted, then
.I filedes
should give the file descriptor for the device by which
the file system is accessed, as returned by a call to
.BR creat() ,
.BR dup() ,
.BR open() ,
or 
.BR pipe() ;
and
.I fstype
contains the type of the file system.
If the file system is mounted, then
.I filedes
should give the file descriptor of a file on the file system in question, and
.I fstype
must be set to zero.
.PP
.B fstatfs()
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 "libc," libc
.Xr "mkfs," mkfs
.Xr "statfs()," statfs
.Xr "statfs.h," statfs.h
.Xr "types.h," types.h
.Xr "ustat()" ustat
