xref: /original-bsd/lib/libc/gen/getmntinfo.3 (revision b366b3c1)
1.\" Copyright (c) 1989, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)getmntinfo.3	6.7 (Berkeley) 01/14/93
7.\"
8.Dd
9.Dt GETMNTINFO 3
10.Os
11.Sh NAME
12.Nm getmntinfo
13.Nd get information about mounted file systems
14.Sh SYNOPSIS
15.Fd #include <sys/param.h>
16.Fd #include <sys/ucred.h>
17.Fd #include <sys/mount.h>
18.Ft int
19.Fn getmntinfo "struct statfs **mntbufp" "int flags"
20.Sh DESCRIPTION
21The
22.Fn getmntinfo
23function
24returns an array of
25.Xr statfs
26structures describing each currently mounted file system (see
27.Xr statfs 2 ) .
28.Pp
29The
30.Fn getmntinfo
31function
32passes its
33.Fa flags
34parameter transparently to
35.Xr getfsstat 2 .
36.Sh RETURN VALUES
37On successful completion,
38.Fn getmntinfo
39returns a count of the number of elements in the array.
40The pointer to the array is stored into
41.Fa mntbufp .
42.Pp
43If an error occurs, zero is returned and the external variable
44.Va errno
45is set to indicate the error.
46Although the pointer
47.Fa mntbufp
48will be unmodified, any information previously returned by
49.Fn getmntinfo
50will be lost.
51.Sh ERRORS
52The
53.Fn getmntinfo
54function
55may fail and set errno for any of the errors specified for the library
56routines
57.Xr getfsstat 2
58or
59.Xr malloc 3 .
60.Sh SEE ALSO
61.Xr getfsstat 2 ,
62.Xr statfs 2 ,
63.Xr mount 2 ,
64.Xr mount 8
65.Sh HISTORY
66The
67.Fn getmntinfo
68function is
69.Ud .
70.Sh BUGS
71The
72.Fn getmntinfo
73function writes the array of structures to an internal static object
74and returns
75a pointer to that object. Subsequent calls to
76.Fn getmntinfo
77will modify the same object.
78.Pp
79The memory allocated by
80.Fn getmntinfo
81cannot be
82.Xr free 2 Ns 'd
83by the application.
84