patches/glibc/ports-2.10.1/130-i386-no-fallocate.patch
changeset 1625 fde082da9813
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/ports-2.10.1/130-i386-no-fallocate.patch	Fri Nov 13 21:37:18 2009 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +Fix building on x86 when older linux headers lack __NR_fallocate define.
     1.5 +
     1.6 +URL: http://bugs.gentoo.org/274269
     1.7 +Reported-by: Mikael Magnusson <mikachu@gmail.com>
     1.8 +
     1.9 +2009-11-09  Mike Frysinger  <vapier@gentoo.org>
    1.10 +
    1.11 +	* sysdeps/unix/sysv/linux/i386/fallocate.c: Include errno.h.
    1.12 +	(fallocate): Return ENOSYS if __NR_fallocate is not defined.
    1.13 +	* sysdeps/unix/sysv/linux/i386/fallocate64.c: Likewise.
    1.14 +
    1.15 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate.c glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate.c
    1.16 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate.c	2009-03-02 17:11:06.000000000 +0100
    1.17 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate.c	2009-11-13 00:49:47.000000000 +0100
    1.18 +@@ -16,6 +16,7 @@
    1.19 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    1.20 +    02111-1307 USA.  */
    1.21 + 
    1.22 ++#include <errno.h>
    1.23 + #include <fcntl.h>
    1.24 + #include <sysdep.h>
    1.25 + 
    1.26 +@@ -28,5 +29,10 @@
    1.27 + int
    1.28 + fallocate (int fd, int mode, __off_t offset, __off_t len)
    1.29 + {
    1.30 ++#ifdef __NR_fallocate
    1.31 +   return __call_fallocate (fd, mode, offset, len);
    1.32 ++#else
    1.33 ++  __set_errno (ENOSYS);
    1.34 ++  return -1;
    1.35 ++#endif
    1.36 + }
    1.37 +diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate64.c glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate64.c
    1.38 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate64.c	2009-03-02 17:10:29.000000000 +0100
    1.39 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate64.c	2009-11-13 00:49:47.000000000 +0100
    1.40 +@@ -16,6 +16,7 @@
    1.41 +    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    1.42 +    02111-1307 USA.  */
    1.43 + 
    1.44 ++#include <errno.h>
    1.45 + #include <fcntl.h>
    1.46 + #include <sysdep.h>
    1.47 + 
    1.48 +@@ -28,5 +29,10 @@
    1.49 + int
    1.50 + __fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
    1.51 + {
    1.52 ++#ifdef __NR_fallocate
    1.53 +   return __call_fallocate (fd, mode, offset, len);
    1.54 ++#else
    1.55 ++  __set_errno (ENOSYS);
    1.56 ++  return -1;
    1.57 ++#endif
    1.58 + }