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 | .\" | |
1cecf242 | 16 | .\" @(#)getfsstat.2 6.2 (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 | |
29 | getfsstat(buf, bufsize) | |
1cecf242 KM |
30 | struct statfs buf[]; |
31 | size_t bufsize; | |
7478d653 KM |
32 | .fi |
33 | .ft R | |
34 | .SH DESCRIPTION | |
35 | .I Getfsstat | |
36 | returns information about all mounted filesystems. | |
37 | .I Buf | |
38 | is a pointer to an array of | |
39 | .I statfs | |
40 | structures 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 | |
44 | typedef quad fsid_t; | |
45 | .sp 1 | |
46 | #define MNAMELEN 32 /* length of buffer for returned name */ | |
47 | .sp 1 | |
48 | struct 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 | |
72 | Fields that are undefined for a particular file system are set to \-1. | |
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. | |
84 | .SH RETURN VALUE | |
85 | Upon successful completion, the number of | |
86 | .I fsstat | |
87 | structures is returned. | |
88 | Otherwise, \-1 is returned and the global variable | |
89 | .I errno | |
90 | is set to indicate the error. | |
91 | .SH ERRORS | |
92 | .I Getfsstat | |
93 | fails if one or more of the following are true: | |
94 | .TP 15 | |
95 | EFAULT | |
96 | .I Buf | |
97 | points to an invalid address. | |
98 | .TP 15 | |
99 | EIO | |
100 | An I/O error occurred while reading from or writing to the file system. | |
101 | .SH "SEE ALSO" | |
102 | statfs(2) |