From 1f3615a1c97a030bca59f728f998947f852679b9 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 15 May 2009 21:00:09 -0700
Subject: [PATCH] Add missing export of fallocate64 on 32-bit platforms.

Due to a pasto the fallocate64 interface, introduced in glibc 2.10,
isn't exported for 32-bit Linux platforms.  It is too late for this
now so exported them for glibc 2.11.
---
 nptl/ChangeLog                                 | 18 ++++++++++++++++++
 sysdeps/unix/sysv/linux/Versions               |  2 +-
 sysdeps/unix/sysv/linux/fallocate64.c          |  2 +-
 sysdeps/unix/sysv/linux/i386/Versions          |  4 ++++
 sysdeps/unix/sysv/linux/i386/fallocate64.c     |  2 +-
 .../unix/sysv/linux/powerpc/powerpc32/Versions |  3 +++
 sysdeps/unix/sysv/linux/s390/s390-32/Versions  |  3 +++
 sysdeps/unix/sysv/linux/sh/Versions            |  3 +++
 sysdeps/unix/sysv/linux/sparc/sparc32/Versions |  3 +++
 sysdeps/unix/sysv/linux/wordsize-64/Versions   |  5 +++++
 10 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/wordsize-64/Versions

diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 24474c3a5f..d596325419 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,21 @@
+2009-05-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/fallocate64.c (__fallocate64_l64):
+	Rename ...
+	(fallocate64): ... to this.
+	* sysdeps/unix/sysv/linux/fallocate64.c (__fallocate64_l64):
+	Rename ...
+	(fallocate64): ... to this.
+	* sysdeps/unix/sysv/linux/Versions (libc): Remove fallocate64.
+	* sysdeps/unix/sysv/linux/wordsize-64/Versions (libc): Add
+	fallocate64@@GLIBC_2.10.
+	* sysdeps/unix/sysv/linux/i386/Versions (libc): Add
+	fallocate64@@GLIBC_2.11.
+	* sysdeps/unix/sysv/linux/s390/s390-32/Versions (libc): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions (libc): Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/Versions (libc): Likewise.
+	* sysdeps/unix/sysv/linux/sh/Versions (libc): Likewise.
+
 2009-05-14  Jakub Jelinek  <jakub@redhat.com>
 
 	* nscd/selinux.c (nscd_avc_destroy): Removed.
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index b348570bda..2b5f2fb03c 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -139,7 +139,7 @@ libc {
     epoll_create1; inotify_init1;
   }
   GLIBC_2.10 {
-    fallocate; fallocate64;
+    fallocate;
   }
   GLIBC_PRIVATE {
     # functions used in other libraries
diff --git a/sysdeps/unix/sysv/linux/fallocate64.c b/sysdeps/unix/sysv/linux/fallocate64.c
index ebcaf671b3..751a7b2275 100644
--- a/sysdeps/unix/sysv/linux/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/fallocate64.c
@@ -23,7 +23,7 @@
 
 /* Reserve storage for the data of the file associated with FD.  */
 int
-__fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
+fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
 {
 #ifdef __NR_fallocate
   return INLINE_SYSCALL (fallocate, 6, fd, mode,
diff --git a/sysdeps/unix/sysv/linux/i386/Versions b/sysdeps/unix/sysv/linux/i386/Versions
index abd1d152d7..f3544acb75 100644
--- a/sysdeps/unix/sysv/linux/i386/Versions
+++ b/sysdeps/unix/sysv/linux/i386/Versions
@@ -41,6 +41,10 @@ libc {
     # v*
     vm86;
   }
+  GLIBC_2.11 {
+    # f*
+    fallocate64;
+  }
   GLIBC_PRIVATE {
     __modify_ldt;
   }
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate64.c b/sysdeps/unix/sysv/linux/i386/fallocate64.c
index b744710a96..4998f5e644 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate64.c
@@ -26,7 +26,7 @@ extern int __call_fallocate (int fd, int mode, __off64_t offset, __off64_t len)
 
 /* Reserve storage for the data of the file associated with FD.  */
 int
-__fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
+fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
 {
   return __call_fallocate (fd, mode, offset, len);
 }
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
index 181d70150c..6fa0119e95 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
@@ -27,4 +27,7 @@ libc {
   GLIBC_2.3.4 {
     setcontext; getcontext; swapcontext; makecontext;
   }
+  GLIBC_2.11 {
+    fallocate64;
+  }
 }
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
index b6d608d0ae..24e0b1d4cd 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/Versions
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
@@ -43,6 +43,9 @@ libc {
     getutmp;
     getutmpx;
   }
+  GLIBC_2.11 {
+    fallocate64;
+  }
 }
 
 libutil {
diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions
index 763be60222..bd30f928d7 100644
--- a/sysdeps/unix/sysv/linux/sh/Versions
+++ b/sysdeps/unix/sysv/linux/sh/Versions
@@ -24,4 +24,7 @@ libc {
   GLIBC_2.3.3 {
     posix_fadvise64; posix_fallocate64;
   }
+  GLIBC_2.11 {
+    fallocate64;
+  }
 }
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
index c585af3602..c9a5b3e9d5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
@@ -20,4 +20,7 @@ libc {
   GLIBC_2.3.3 {
     posix_fadvise64; posix_fallocate64;
   }
+  GLIBC_2.11 {
+    fallocate64;
+  }
 }
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/Versions b/sysdeps/unix/sysv/linux/wordsize-64/Versions
new file mode 100644
index 0000000000..a3b40ccd17
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/wordsize-64/Versions
@@ -0,0 +1,5 @@
+libc {
+  GLIBC_2.10 {
+    fallocate64;
+  }
+}