add -n flag to skip calls to underlying filesystem
[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.\"
1cecf242 16.\" @(#)getfsstat.2 6.2 (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
29getfsstat(buf, bufsize)
1cecf242
KM
30struct statfs buf[];
31size_t bufsize;
7478d653
KM
32.fi
33.ft R
34.SH DESCRIPTION
35.I Getfsstat
36returns information about all mounted filesystems.
37.I Buf
38is a pointer to an array of
39.I statfs
40structures defined as follows:
41.IP
42.ta \w'#define\0\0'u +\w'fsid_t\0\0'u +\w'f_mntfromname[MNAMELEN]\0\0'u
43.nf
44typedef quad fsid_t;
45.sp 1
46#define MNAMELEN 32 /* length of buffer for returned name */
47.sp 1
48struct statfs {
49 short f_type; /* type of filesystem (see below) */
50 short f_flags; /* copy of mount flags */
51 long f_fsize; /* fundamental file system block size */
52 long f_bsize; /* optimal transfer block size */
53 long f_blocks; /* total data blocks in file system */
54 long f_bfree; /* free blocks in fs */
55 long f_bavail; /* free blocks avail to non-superuser */
56 long f_files; /* total file nodes in file system */
57 long f_ffree; /* free file nodes in fs */
58 fsid_t f_fsid; /* file system id */
59 long f_spare[6]; /* spare for later */
60 char f_mntonname[MNAMELEN]; /* directory on which mounted */
61 char f_mntfromname[MNAMELEN]; /* mounted filesystem */
62};
63/*
64 * File system types.
65 */
66#define MOUNT_UFS 1
67#define MOUNT_NFS 2
1cecf242
KM
68#define MOUNT_MFS 3
69#define MOUNT_PC 4
7478d653
KM
70.fi
71.PP
72Fields that are undefined for a particular file system are set to \-1.
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.
84.SH RETURN VALUE
85Upon successful completion, the number of
86.I fsstat
87structures is returned.
88Otherwise, \-1 is returned and the global variable
89.I errno
90is set to indicate the error.
91.SH ERRORS
92.I Getfsstat
93fails if one or more of the following are true:
94.TP 15
95EFAULT
96.I Buf
97points to an invalid address.
98.TP 15
99EIO
100An I/O error occurred while reading from or writing to the file system.
101.SH "SEE ALSO"
102statfs(2)