gno/usr.man/man2/statfs.2
1997-02-27 07:32:31 +00:00

104 lines
3.8 KiB
Groff

.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)statfs.2 8.3 (Berkeley) 2/11/94
.\"
.TH STATFS 2 "23 January 1997" GNO "System Calls"
.SH NAME
.BR statfs
\- get file system statistics
.SH SYNOPSIS
#include <sys/param.h>
.br
#include <sys/mount.h>
.sp 1
int
\fBstatfs\fR (const char *\fIpath\fR, struct statfs *\fIbuf\fR);
.sp 1
int
\fBfstatfs\fR (int \fIfd\fR, struct statfs *\fIbuf\fR);
.SH DESCRIPTION
.BR statfs
returns information about a mounted file system.
.I path
is the path name of any file within the mounted filesystem.
.I buf
is a pointer to a
.BR statfs
structure defined as follows:
.nf
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 */
.fi
.LP
Fields that are undefined for a particular file system are set to -1.
.BR fstatfs
returns the same information about an open file referenced by descriptor
.IR fd .
.SH RETURN VALUES
Upon successful completion, a value of 0 is returned.
Otherwise, -1 is returned and the global variable
.IR errno
is set to indicate the error.
.SH HISTORY
The
.BR statfs
function first appeared in 4.4BSD.