date and time created 91/03/06 18:09:53 by bostic
[unix-history] / usr / src / lib / libc / sys / getfsstat.2
CommitLineData
7478d653
KM
1.\" Copyright (c) 1989 The Regents of the University of California.
2.\" All rights reserved.
3.\"
91cff1e1 4.\" %sccs.include.redist.man%
7478d653 5.\"
91cff1e1 6.\" @(#)getfsstat.2 6.4 (Berkeley) %G%
7478d653
KM
7.\"
8.TH GETFSSTAT 2 ""
9.UC 7
10.SH NAME
11getfsstat \- get list of all mounted filesystems
12.SH SYNOPSIS
13.nf
14.ft B
15#include <sys/types.h>
16#include <sys/mount.h>
17.LP
18.ft B
4debe936
KM
19getfsstat(buf, bufsize, flags)
20struct statfs *buf[];
21long bufsize;
22int flags;
7478d653
KM
23.fi
24.ft R
25.SH DESCRIPTION
26.I Getfsstat
27returns information about all mounted filesystems.
28.I Buf
29is a pointer to an array of
30.I statfs
31structures defined as follows:
32.IP
33.ta \w'#define\0\0'u +\w'fsid_t\0\0'u +\w'f_mntfromname[MNAMELEN]\0\0'u
34.nf
35typedef quad fsid_t;
36.sp 1
37#define MNAMELEN 32 /* length of buffer for returned name */
38.sp 1
39struct statfs {
40 short f_type; /* type of filesystem (see below) */
41 short f_flags; /* copy of mount flags */
4debe936 42 long f_fsize; /* fundamental filesystem block size */
7478d653 43 long f_bsize; /* optimal transfer block size */
4debe936 44 long f_blocks; /* total data blocks in filesystem */
7478d653
KM
45 long f_bfree; /* free blocks in fs */
46 long f_bavail; /* free blocks avail to non-superuser */
4debe936 47 long f_files; /* total file nodes in filesystem */
7478d653 48 long f_ffree; /* free file nodes in fs */
4debe936 49 fsid_t f_fsid; /* filesystem id */
7478d653
KM
50 long f_spare[6]; /* spare for later */
51 char f_mntonname[MNAMELEN]; /* directory on which mounted */
52 char f_mntfromname[MNAMELEN]; /* mounted filesystem */
53};
54/*
55 * File system types.
56 */
57#define MOUNT_UFS 1
58#define MOUNT_NFS 2
4debe936 59#define MOUNT_PC 3
7478d653
KM
60.fi
61.PP
4debe936 62Fields that are undefined for a particular filesystem are set to \-1.
7478d653
KM
63The buffer is filled with an array of
64.I fsstat
65structures, one for each mounted filesystem
66up to the size specified by
67.I bufsize .
68.PP
69If
70.I buf
71is given as zero,
72.I getfsstat
73returns just the number of mounted filesystems.
4debe936
KM
74.PP
75Normally
76.I flags
77should be specified as MNT_WAIT.
78If
79.I flags
80is set to MNT_NOWAIT, then
81.I getfsstat
82will return the information it has available without requesting
83an update from each filesystem.
84Thus, some of the information will be out of date, but
85.I getfsstat
86will not block waiting for information from a filesystem that is
87unable to respond.
7478d653
KM
88.SH RETURN VALUE
89Upon successful completion, the number of
90.I fsstat
91structures is returned.
92Otherwise, \-1 is returned and the global variable
93.I errno
94is set to indicate the error.
95.SH ERRORS
96.I Getfsstat
97fails if one or more of the following are true:
98.TP 15
99EFAULT
100.I Buf
101points to an invalid address.
102.TP 15
103EIO
4debe936 104An I/O error occurred while reading from or writing to the filesystem.
7478d653 105.SH "SEE ALSO"
4debe936 106statfs(2), fstab(5), mount(8)