On 12/11/10 11:07, Allan McRae wrote:
So, looking into this further:
getmntent: used by glibc, uclibc, cygwin
getmntinfo with statfs: used by bsd4.4 (FreeBSD, OpenBSD, OSX)
getmntinfo with statvfs: NetBSD
I can work with that... the mount point struct can hold a statfs or statvfs object depending on what function we are using. Given the entries that we need to access are available in both structs, the rest should be transparent.
So what I need to do is: 1) figure out how to distinguish between the two getmntinfo versions...
So having a peak at how coreutils does this... Restating the prototype for a function does not create a compiler error. But stating a modified prototype for a function causes an error. So I need one of those "if this compiles" tests. Should be manageable.
2) add a code path for the second getmntinfo 3) review what headers need included in each path
Just to put my notes on the list: NetBSD: #include <sys/types.h> #include <sys/statvfs.h> FreeBSD/OSX: #include <sys/param.h> #include <sys/ucred.h> #include <sys/mount.h> OpenBSD: #include <sys/param.h> #include <sys/mount.h> Glibc: #include <stdio.h> #include <mntent.h> #include <sys/statvfs.h> Fun stuff... Allan