about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMike Frsyinger <vapier@gentoo.org>2009-11-14 19:16:01 -0800
committerUlrich Drepper <drepper@redhat.com>2009-11-14 19:16:01 -0800
commitf9a7bd536e0b1693db32e1330bbd96108ca63c42 (patch)
tree769f0fe8abca7c7a2f204535e9290a6f1b1d0e78
parent5ec794b4b537bc507010af28d2d93bb76d0972ac (diff)
downloadglibc-f9a7bd536e0b1693db32e1330bbd96108ca63c42.tar.gz
glibc-f9a7bd536e0b1693db32e1330bbd96108ca63c42.tar.xz
glibc-f9a7bd536e0b1693db32e1330bbd96108ca63c42.zip
Fix building on x86 with older kernel headers.
Fix building on x86 when older linux headers lack __NR_fallocate define.
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate64.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate.c b/sysdeps/unix/sysv/linux/i386/fallocate.c
index 7a943e44c0..14e788386c 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate.c
@@ -16,6 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
 #include <fcntl.h>
 #include <sysdep.h>
 
@@ -28,5 +29,10 @@ extern int __call_fallocate (int fd, int mode, __off64_t offset, __off64_t len)
 int
 fallocate (int fd, int mode, __off_t offset, __off_t len)
 {
+#ifdef __NR_fallocate
   return __call_fallocate (fd, mode, offset, len);
+#else
+  __set_errno (ENOSYS);
+  return -1;
+#endif
 }
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate64.c b/sysdeps/unix/sysv/linux/i386/fallocate64.c
index 4998f5e644..85f315c9b6 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate64.c
@@ -16,6 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
 #include <fcntl.h>
 #include <sysdep.h>
 
@@ -28,5 +29,10 @@ extern int __call_fallocate (int fd, int mode, __off64_t offset, __off64_t len)
 int
 fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
 {
+#ifdef __NR_fallocate
   return __call_fallocate (fd, mode, offset, len);
+#else
+  __set_errno (ENOSYS);
+  return -1;
+#endif
 }