(ME_DUMMY): Treat "kernfs" as a dummy.
(read_file_system_list) [MOUNTED_GETMNTINFO2]: Implement.
* m4/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Also check for
sys/statvfs.h. When getmntinfo was found, check its declaration and
set either MOUNTED_GETMNTINFO or MOUNTED_GETMNTINFO2 depending on it.
+2006-08-18 Bruno Haible <bruno@clisp.org>
+
+ * mountlist.c [MOUNTED_GETMNTINFO2]: Include sys/statvfs.h.
+ (ME_DUMMY): Treat "kernfs" as a dummy.
+ (read_file_system_list) [MOUNTED_GETMNTINFO2]: Implement.
+
2006-08-17 Paul Eggert <eggert@cs.ucla.edu>
Update from coreutils.
# include <sys/mount.h>
#endif
+#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
+# include <sys/statvfs.h>
+#endif
+
#ifdef MOUNTED_GETMNT /* Ultrix. */
# include <sys/mount.h>
# include <sys/fs_types.h>
|| strcmp (Fs_type, "none") == 0 \
|| strcmp (Fs_type, "proc") == 0 \
|| strcmp (Fs_type, "subfs") == 0 \
+ /* for NetBSD 3.0 */ \
+ || strcmp (Fs_type, "kernfs") == 0 \
/* for Irix 6.5 */ \
|| strcmp (Fs_type, "ignore") == 0)
#endif
}
# endif /* ! HAVE_F_FSTYPENAME_IN_STATFS */
-/* __NetBSD__ || BSD_NET2 || __OpenBSD__ */
static char *
fsp_to_string (const struct statfs *fsp)
{
}
#endif /* MOUNTED_GETMNTINFO */
+#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
+ {
+ struct statvfs *fsp;
+ int entries;
+
+ entries = getmntinfo (&fsp, MNT_NOWAIT);
+ if (entries < 0)
+ return NULL;
+ for (; entries-- > 0; fsp++)
+ {
+ me = xmalloc (sizeof *me);
+ me->me_devname = xstrdup (fsp->f_mntfromname);
+ me->me_mountdir = xstrdup (fsp->f_mntonname);
+ me->me_type = xstrdup (fsp->f_fstypename);
+ me->me_type_malloced = 1;
+ me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
+ me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+ me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
+
+ /* Add to the linked list. */
+ *mtail = me;
+ mtail = &me->me_next;
+ }
+ }
+#endif /* MOUNTED_GETMNTINFO2 */
+
#ifdef MOUNTED_GETMNT /* Ultrix. */
{
int offset = 0;
+2006-08-18 Bruno Haible <bruno@clisp.org>
+
+ * ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Also check for
+ sys/statvfs.h. When getmntinfo was found, check its declaration and
+ set either MOUNTED_GETMNTINFO or MOUNTED_GETMNTINFO2 depending on it.
+
2006-08-18 Jim Meyering <jim@meyering.net>
* gethrxtime.m4 (gl_PREREQ_GETHRXTIME): Also check for CLOCK_REALTIME,
-#serial 21
+#serial 22
# How to list mounted file systems.
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software
AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS],
[
AC_CHECK_FUNCS(listmntent getmntinfo)
-AC_CHECK_HEADERS_ONCE(sys/param.h)
+AC_CHECK_HEADERS_ONCE(sys/param.h sys/statvfs.h)
# We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses
# NGROUPS (as the array dimension for a struct member) without a definition.
])
AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
if test $fu_cv_sys_mounted_getmntinfo = yes; then
- ac_list_mounted_fs=found
- AC_DEFINE(MOUNTED_GETMNTINFO, 1,
- [Define if there is a function named getmntinfo for reading the
- list of mounted file systems. (4.4BSD, Darwin)])
+ AC_MSG_CHECKING([whether getmntinfo returns statvfs structures])
+ AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo2,
+ [
+ AC_TRY_COMPILE([
+#include <sys/types.h>
+#if HAVE_SYS_MOUNT_H
+# include <sys/mount.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+# include <sys/statvfs.h>
+#endif
+extern int getmntinfo (struct statfs **, int);
+ ], [],
+ [fu_cv_sys_mounted_getmntinfo2=no],
+ [fu_cv_sys_mounted_getmntinfo2=yes])
+ ])
+ AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo2])
+ if test $fu_cv_sys_mounted_getmntinfo2 = no; then
+ ac_list_mounted_fs=found
+ AC_DEFINE(MOUNTED_GETMNTINFO, 1,
+ [Define if there is a function named getmntinfo for reading the
+ list of mounted file systems and it returns an array of
+ 'struct statfs'. (4.4BSD, Darwin)])
+ else
+ ac_list_mounted_fs=found
+ AC_DEFINE(MOUNTED_GETMNTINFO2, 1,
+ [Define if there is a function named getmntinfo for reading the
+ list of mounted file systems and it returns an array of
+ 'struct statvfs'. (NetBSD 3.0)])
+ fi
fi
fi