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