1.\" Copyright (c) 1989, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)getmntinfo.3 8.1 (Berkeley) 06/09/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 first appeared in 4.4BSD. 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