xref: /original-bsd/lib/libc/gen/getmntinfo.3 (revision a1c2194a)
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.5 (Berkeley) 04/19/91
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/types.h>
16.Fd #include <sys/mount.h>
17.Ft int
18.Fn getmntinfo "int mntbufp" "int flags"
19.Sh DESCRIPTION
20The
21.Fn getmntinfo
22function
23returns an array of
24.Xr statfs
25structures describing each currently mounted file system (see
26.Xr statfs 2 ) .
27.Pp
28The
29.Fn getmntinfo
30function
31passes its
32.Fa flags
33parameter transparently to
34.Xr getfsstat 2 .
35.Sh RETURN VALUES
36On successful completion,
37.Fn getmntinfo
38returns a count of the number of elements in the array.
39The pointer to the array is stored into
40.Fa mntbufp .
41.Pp
42If an error occurs, zero is returned and the external variable
43.Va errno
44is set to indicate the error.
45Although the pointer
46.Fa mntbufp
47will be unmodified, any information previously returned by
48.Fn getmntinfo
49will be lost.
50.Sh ERRORS
51The
52.Fn getmntinfo
53function
54may fail and set errno for any of the errors specified for the library
55routines
56.Xr getfsstat 2
57or
58.Xr malloc 3 .
59.Sh SEE ALSO
60.Xr getfsstat 2 ,
61.Xr statfs 2 ,
62.Xr mount 2 ,
63.Xr mount 8
64.Sh HISTORY
65The
66.Fn getmntinfo
67function is
68.Ud .
69.Sh BUGS
70The
71.Fn getmntinfo
72function writes the array of structures to an internal static object
73and returns
74a pointer to that object. Subsequent calls to
75.Fn getmntinfo
76will modify the same object.
77.Pp
78The memory allocated by
79.Fn getmntinfo
80cannot be
81.Xr free 2 Ns 'd
82by the application.
83