#include <errno.h>
+#include <string.h>
+
#include "mph.h"
+#include "map.h"
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
to->f_ffree = from->f_ffree;
to->f_favail = from->f_favail;
to->f_fsid = from->f_fsid;
- to->f_flag = from->f_flag;
+ Mono_Posix_ToMountFlags (from->f_flag, &to->f_flag);
to->f_namemax = from->f_namemax;
}
#endif /* ndef HAVE_SYS_STATVFS_H */
copy_statfs (struct Mono_Posix_Statvfs *to, struct statfs *from)
{
to->f_bsize = from->f_bsize;
- to->f_frsize = from->f_frsize;
+ to->f_frsize = from->f_bsize;
to->f_blocks = from->f_blocks;
to->f_bfree = from->f_bfree;
to->f_bavail = from->f_bavail;
to->f_files = from->f_files;
to->f_ffree = from->f_ffree;
to->f_favail = from->f_ffree; /* OSX doesn't have f_avail */
- to->f_fsid = from->f_fsid;
- to->f_flag = from->f_flags;
+ Mono_Posix_ToMountFlags (from->f_flags, &to->f_flag);
+ // from->f_fsid is an int32[2], to->f_fsid is a uint64,
+ // so this shouldn't lose anything.
+ memcpy (&to->f_fsid, &from->f_fsid, sizeof(to->f_fsid));
}
static void
{
buf->f_namemax = pathconf (path, _PC_NAME_MAX);
}
+
+static void
+set_fnamemax (int fd, struct Mono_Posix_Statvfs *buf)
+{
+ buf->f_namemax = fpathconf (fd, _PC_NAME_MAX);
+}
#endif /* (def HAVE_STATFS || def HAVE_FSTATFS) && !def HAVE_STATVFS */
#if !defined (HAVE_STATVFS) && defined (HAVE_STATFS)
}
if ((r = fstatfs (fd, &s)) == 0) {
- copy_statvfs (buf, &s);
- set_namemax (path, buf);
+ copy_statfs (buf, &s);
+ set_fnamemax (fd, buf);
}
return r;