1.\"	$NetBSD: getmntinfo.3,v 1.16 2016/06/12 09:42:41 abhinav Exp $
2.\"
3.\" Copyright (c) 1989, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"     @(#)getmntinfo.3	8.1 (Berkeley) 6/9/93
31.\"
32.Dd June 2, 2016
33.Dt GETMNTINFO 3
34.Os
35.Sh NAME
36.Nm getmntinfo
37.Nd get information about mounted file systems
38.Sh LIBRARY
39.Lb libc
40.Sh SYNOPSIS
41.In sys/types.h
42.In sys/statvfs.h
43.Ft int
44.Fn getmntinfo "struct statvfs **mntbufp" "int flags"
45.Sh DESCRIPTION
46The
47.Fn getmntinfo
48function returns an array of
49.Em statvfs
50structures describing each currently mounted file system (see
51.Xr statvfs 2 ) .
52.Pp
53The
54.Fn getmntinfo
55function
56passes its
57.Fa flags
58parameter transparently to
59.Xr getvfsstat 2 .
60.Sh RETURN VALUES
61On successful completion,
62.Fn getmntinfo
63returns a count of the number of elements in the array.
64The pointer to the array is stored into
65.Fa mntbufp .
66.Pp
67If an error occurs, zero is returned and the external variable
68.Va errno
69is set to indicate the error.
70Although the pointer
71.Fa mntbufp
72will be unmodified, any information previously returned by
73.Fn getmntinfo
74will be lost.
75.Sh ERRORS
76The
77.Fn getmntinfo
78function
79may fail and set
80.Va errno
81for any of the errors specified for the library routines
82.Xr getvfsstat 2
83or
84.Xr malloc 3 .
85.Sh SEE ALSO
86.Xr getvfsstat 2 ,
87.Xr mount 2 ,
88.Xr statvfs 2 ,
89.Xr mount 8
90.Sh HISTORY
91The
92.Fn getmntinfo
93function first appeared in
94.Bx 4.4 .
95It was converted from using
96.Fn getfsstat
97to
98.Xr getvfsstat 2
99in
100.Nx 3.0 .
101.Sh BUGS
102The
103.Fn getmntinfo
104function writes the array of structures to an internal static object
105and returns
106a pointer to that object.
107Subsequent calls to
108.Fn getmntinfo
109will modify the same object.
110.Pp
111The memory allocated by
112.Fn getmntinfo
113cannot be
114.Xr free 3 Ns 'd
115by the application.
116