diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2006-08-18 18:36:04 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2006-08-18 18:36:04 +0000 |
commit | 5f57935678613334bfa18ee547cb1f22a3a0a7dd (patch) | |
tree | e102859dc4d733d8423f0aaf91e26a8c3f9c0d2e /lib/mountlist.c | |
parent | 47c8512a6ff9a6df52f6848ff7881e5c55b719c2 (diff) | |
download | coreutils-5f57935678613334bfa18ee547cb1f22a3a0a7dd.tar.xz |
Add support for NetBSD 3.0.
* src/stat.c (USE_STATVFS): Set to 1 if 'struct statvfs' has a field
f_fstypename.
(STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME): Define also if 'struct statvfs'
has a field f_fstypename.
This undoes the 2006-08-15 to src/stat.c.
* lib/mountlist.c [MOUNTED_GETMNTINFO2]: Include sys/statvfs.h.
(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.
* m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Test also for f_fstypename
in struct statvfs.
Diffstat (limited to 'lib/mountlist.c')
-rw-r--r-- | lib/mountlist.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/mountlist.c b/lib/mountlist.c index 3774c8e4e..1b6424101 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -82,6 +82,10 @@ char *strstr (); # 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> @@ -147,6 +151,8 @@ char *strstr (); || 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 @@ -260,7 +266,6 @@ fstype_to_string (short int t) } # endif /* ! HAVE_F_FSTYPENAME_IN_STATFS */ -/* __NetBSD__ || BSD_NET2 || __OpenBSD__ */ static char * fsp_to_string (const struct statfs *fsp) { @@ -426,6 +431,32 @@ read_file_system_list (bool need_fs_type) } #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; |