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