|
@@ -22,8 +22,10 @@
|
|
|
#include <string.h>
|
|
|
#include <sys/statfs.h>
|
|
|
#include <sys/statvfs.h>
|
|
|
+#include <sys/syscall.h>
|
|
|
#include <stddef.h>
|
|
|
|
|
|
+#if defined __NR_fstatfs
|
|
|
extern __typeof(fstatfs) __libc_fstatfs;
|
|
|
|
|
|
/* Return information about the filesystem on which FD resides. */
|
|
@@ -42,12 +44,24 @@ int fstatfs64 (int fd, struct statfs64 *buf)
|
|
|
buf->f_files = buf32.f_files;
|
|
|
buf->f_ffree = buf32.f_ffree;
|
|
|
buf->f_fsid = buf32.f_fsid;
|
|
|
-#ifdef _STATFS_F_FRSIZE
|
|
|
+# ifdef _STATFS_F_FRSIZE
|
|
|
buf->f_frsize = buf32.f_frsize;
|
|
|
-#endif
|
|
|
+# endif
|
|
|
buf->f_namelen = buf32.f_namelen;
|
|
|
memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
+#else
|
|
|
+/*
|
|
|
+ * Use the fstatfs64 system call if fstatfs is not defined
|
|
|
+ * This is for backwards compatibility and it should be
|
|
|
+ * made default in the future
|
|
|
+ */
|
|
|
+int fstatfs64(int fd, struct statfs64 *buf)
|
|
|
+{
|
|
|
+ /* Signature has 2 arguments but syscalls wants 3 */
|
|
|
+ return INLINE_SYSCALL(fstatfs64, 3, fd, sizeof(*buf), buf);
|
|
|
+}
|
|
|
+#endif
|
|
|
libc_hidden_def(fstatfs64)
|