Fix statfs/fstatfs on systems which have statfs64/fstatfs64

diff --git a/klibc/Makefile b/klibc/Makefile
index 1840f33..b05a7e4 100644
--- a/klibc/Makefile
+++ b/klibc/Makefile
@@ -19,6 +19,7 @@
 	  execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \
 	  fork.o wait.o wait3.o waitpid.o system.o setpgrp.o getpgrp.o \
 	  printf.o vprintf.o fprintf.o vfprintf.o perror.o \
+	  statfs.o fstatfs.o \
 	  open.o fopen.o fread.o fread2.o fgetc.o fgets.o \
 	  fwrite.o fwrite2.o fputc.o fputs.o puts.o \
 	  sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \
diff --git a/klibc/SYSCALLS.def b/klibc/SYSCALLS.def
index 814f0f8..107e384 100644
--- a/klibc/SYSCALLS.def
+++ b/klibc/SYSCALLS.def
@@ -1,7 +1,7 @@
 ; -*- fundamental -*-
 ;
 ; This is a list of system calls we invoke "directly".  These
-; are generated into syscall stubs in their own C files, so the
+; are generated into syscall stubs in their own files, so the
 ; linker can do its job properly.
 ;
 ; The full description of a line is:
@@ -66,8 +66,16 @@
 <alpha,ia64> int umount::umount2(const char *, int)
 <!m68k> int pivot_root(const char *, const char *)
 int sync()
-int statfs64,statfs::statfs(const char *, struct statfs *)
-int fstatfs64,fstatfs::fstatfs(int, struct statfs *)
+#ifdef __NR_statfs64
+int statfs64::__statfs64(const char *, size_t, struct statfs *)
+#else
+int statfs(const char *, struct statfs *)
+#endif
+#ifdef __NR_fstatfs64
+int fstatfs64::__fstatfs64(int, size_t, struct statfs *)
+#else
+int fstatfs(int, struct statfs *)
+#endif
 int swapon(const char *, int)
 int swapoff(const char *)
 
diff --git a/klibc/fstatfs.c b/klibc/fstatfs.c
new file mode 100644
index 0000000..09e4674
--- /dev/null
+++ b/klibc/fstatfs.c
@@ -0,0 +1,19 @@
+/*
+ * fstatfs.c
+ *
+ * On architectures which do fstatfs64, wrap the system call
+ */
+
+#include <sys/syscall.h>
+#include <sys/vfs.h>
+
+#ifdef __NR_fstatfs64
+
+extern int __fstatfs64(int, size_t, struct statfs *);
+
+int fstatfs(int fd, struct statfs *buf)
+{
+  return __fstatfs64(fd, sizeof *buf, buf);
+}
+
+#endif
diff --git a/klibc/statfs.c b/klibc/statfs.c
new file mode 100644
index 0000000..60e9188
--- /dev/null
+++ b/klibc/statfs.c
@@ -0,0 +1,19 @@
+/*
+ * statfs.c
+ *
+ * On architectures which do statfs64, wrap the system call
+ */
+
+#include <sys/syscall.h>
+#include <sys/vfs.h>
+
+#ifdef __NR_statfs64
+
+extern int __statfs64(const char *, size_t, struct statfs *);
+
+int statfs(const char *path, struct statfs *buf)
+{
+  return __statfs64(path, sizeof *buf, buf);
+}
+
+#endif