* Copyright (c) 1989 The Regents of the University of California.
* %sccs.include.redist.c%
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)getmntinfo.c 6.3 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
* Return information about mounted filesystems.
getmntinfo(mntbufp
, flags
)
static struct statfs
*mntbuf
;
static int mntsize
, bufsize
;
if (mntsize
<= 0 && (mntsize
= getfsstat(0, 0, MNT_NOWAIT
)) < 0)
if (bufsize
> 0 && (mntsize
= getfsstat(mntbuf
, bufsize
, flags
)) < 0)
while (bufsize
<= mntsize
* sizeof(struct statfs
)) {
bufsize
= (mntsize
+ 1) * sizeof(struct statfs
);
if ((mntbuf
= (struct statfs
*)malloc(bufsize
)) == 0)
if ((mntsize
= getfsstat(mntbuf
, bufsize
, flags
)) < 0)