minor error inspec
[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.\"
4.\" Redistribution and use in source and binary forms are permitted
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15.\"
4debe936 16.\" @(#)getfsstat.2 6.3 (Berkeley) %G%
7478d653
KM
17.\"
18.TH GETFSSTAT 2 ""
19.UC 7
20.SH NAME
21getfsstat \- get list of all mounted filesystems
22.SH SYNOPSIS
23.nf
24.ft B
25#include <sys/types.h>
26#include <sys/mount.h>
27.LP
28.ft B
4debe936
KM
29getfsstat(buf, bufsize, flags)
30struct statfs *buf[];
31long bufsize;
32int flags;
7478d653
KM
33.fi
34.ft R
35.SH DESCRIPTION
36.I Getfsstat
37returns information about all mounted filesystems.
38.I Buf
39is a pointer to an array of
40.I statfs
41structures defined as follows:
42.IP
43.ta \w'#define\0\0'u +\w'fsid_t\0\0'u +\w'f_mntfromname[MNAMELEN]\0\0'u
44.nf
45typedef quad fsid_t;
46.sp 1
47#define MNAMELEN 32 /* length of buffer for returned name */
48.sp 1
49struct statfs {
50 short f_type; /* type of filesystem (see below) */
51 short f_flags; /* copy of mount flags */
4debe936 52 long f_fsize; /* fundamental filesystem block size */
7478d653 53 long f_bsize; /* optimal transfer block size */
4debe936 54 long f_blocks; /* total data blocks in filesystem */
7478d653
KM
55 long f_bfree; /* free blocks in fs */
56 long f_bavail; /* free blocks avail to non-superuser */
4debe936 57 long f_files; /* total file nodes in filesystem */
7478d653 58 long f_ffree; /* free file nodes in fs */
4debe936 59 fsid_t f_fsid; /* filesystem id */
7478d653
KM
60 long f_spare[6]; /* spare for later */
61 char f_mntonname[MNAMELEN]; /* directory on which mounted */
62 char f_mntfromname[MNAMELEN]; /* mounted filesystem */
63};
64/*
65 * File system types.
66 */
67#define MOUNT_UFS 1
68#define MOUNT_NFS 2
4debe936 69#define MOUNT_PC 3
7478d653
KM
70.fi
71.PP
4debe936 72Fields that are undefined for a particular filesystem are set to \-1.
7478d653
KM
73The buffer is filled with an array of
74.I fsstat
75structures, one for each mounted filesystem
76up to the size specified by
77.I bufsize .
78.PP
79If
80.I buf
81is given as zero,
82.I getfsstat
83returns just the number of mounted filesystems.
4debe936
KM
84.PP
85Normally
86.I flags
87should be specified as MNT_WAIT.
88If
89.I flags
90is set to MNT_NOWAIT, then
91.I getfsstat
92will return the information it has available without requesting
93an update from each filesystem.
94Thus, some of the information will be out of date, but
95.I getfsstat
96will not block waiting for information from a filesystem that is
97unable to respond.
7478d653
KM
98.SH RETURN VALUE
99Upon successful completion, the number of
100.I fsstat
101structures is returned.
102Otherwise, \-1 is returned and the global variable
103.I errno
104is set to indicate the error.
105.SH ERRORS
106.I Getfsstat
107fails if one or more of the following are true:
108.TP 15
109EFAULT
110.I Buf
111points to an invalid address.
112.TP 15
113EIO
4debe936 114An I/O error occurred while reading from or writing to the filesystem.
7478d653 115.SH "SEE ALSO"
4debe936 116statfs(2), fstab(5), mount(8)