Commit | Line | Data |
---|---|---|
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 | |
11 | getfsstat \- 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 |
19 | getfsstat(buf, bufsize, flags) |
20 | struct statfs *buf[]; | |
21 | long bufsize; | |
22 | int flags; | |
7478d653 KM |
23 | .fi |
24 | .ft R | |
25 | .SH DESCRIPTION | |
26 | .I Getfsstat | |
27 | returns information about all mounted filesystems. | |
28 | .I Buf | |
29 | is a pointer to an array of | |
30 | .I statfs | |
31 | structures 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 | |
35 | typedef quad fsid_t; | |
36 | .sp 1 | |
37 | #define MNAMELEN 32 /* length of buffer for returned name */ | |
38 | .sp 1 | |
39 | struct 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 | 62 | Fields that are undefined for a particular filesystem are set to \-1. |
7478d653 KM |
63 | The buffer is filled with an array of |
64 | .I fsstat | |
65 | structures, one for each mounted filesystem | |
66 | up to the size specified by | |
67 | .I bufsize . | |
68 | .PP | |
69 | If | |
70 | .I buf | |
71 | is given as zero, | |
72 | .I getfsstat | |
73 | returns just the number of mounted filesystems. | |
4debe936 KM |
74 | .PP |
75 | Normally | |
76 | .I flags | |
77 | should be specified as MNT_WAIT. | |
78 | If | |
79 | .I flags | |
80 | is set to MNT_NOWAIT, then | |
81 | .I getfsstat | |
82 | will return the information it has available without requesting | |
83 | an update from each filesystem. | |
84 | Thus, some of the information will be out of date, but | |
85 | .I getfsstat | |
86 | will not block waiting for information from a filesystem that is | |
87 | unable to respond. | |
7478d653 KM |
88 | .SH RETURN VALUE |
89 | Upon successful completion, the number of | |
90 | .I fsstat | |
91 | structures is returned. | |
92 | Otherwise, \-1 is returned and the global variable | |
93 | .I errno | |
94 | is set to indicate the error. | |
95 | .SH ERRORS | |
96 | .I Getfsstat | |
97 | fails if one or more of the following are true: | |
98 | .TP 15 | |
99 | EFAULT | |
100 | .I Buf | |
101 | points to an invalid address. | |
102 | .TP 15 | |
103 | EIO | |
4debe936 | 104 | An I/O error occurred while reading from or writing to the filesystem. |
7478d653 | 105 | .SH "SEE ALSO" |
4debe936 | 106 | statfs(2), fstab(5), mount(8) |