patches/glibc/ports-2.10.1/130-i386-no-fallocate.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Dec 12 21:41:16 2011 +0200 (2011-12-12)
branch1.13
changeset 2845 0dc9d4931246
permissions -rw-r--r--
scripts: unset CONFIG_SITE

Some distributions (eg. openSUSE 12.1) systematically export
the CONFIG_SITE environment variable to point to a custom
script setting misc paths for ./configure.

This can, and does, break when cross-compiling for architectures
that are not supported by this script.

The simple workaround is to unset this variable.
NB: buildroot has a similar fix:
http://git.buildroot.org/buildroot/commit/?id=12c9f7dd6dee9c6029b4f9a12d6aac1516911ab4

Reported-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 21f4f28e60ec0342133086c9a51e7f0e5b181fb8)
     1 Fix building on x86 when older linux headers lack __NR_fallocate define.
     2 
     3 URL: http://bugs.gentoo.org/274269
     4 Reported-by: Mikael Magnusson <mikachu@gmail.com>
     5 
     6 2009-11-09  Mike Frysinger  <vapier@gentoo.org>
     7 
     8 	* sysdeps/unix/sysv/linux/i386/fallocate.c: Include errno.h.
     9 	(fallocate): Return ENOSYS if __NR_fallocate is not defined.
    10 	* sysdeps/unix/sysv/linux/i386/fallocate64.c: Likewise.
    11 
    12 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
    13 --- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate.c	2009-03-02 17:11:06.000000000 +0100
    14 +++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate.c	2009-11-13 00:49:47.000000000 +0100
    15 @@ -16,6 +16,7 @@
    16     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    17     02111-1307 USA.  */
    18  
    19 +#include <errno.h>
    20  #include <fcntl.h>
    21  #include <sysdep.h>
    22  
    23 @@ -28,5 +29,10 @@
    24  int
    25  fallocate (int fd, int mode, __off_t offset, __off_t len)
    26  {
    27 +#ifdef __NR_fallocate
    28    return __call_fallocate (fd, mode, offset, len);
    29 +#else
    30 +  __set_errno (ENOSYS);
    31 +  return -1;
    32 +#endif
    33  }
    34 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
    35 --- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate64.c	2009-03-02 17:10:29.000000000 +0100
    36 +++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate64.c	2009-11-13 00:49:47.000000000 +0100
    37 @@ -16,6 +16,7 @@
    38     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    39     02111-1307 USA.  */
    40  
    41 +#include <errno.h>
    42  #include <fcntl.h>
    43  #include <sysdep.h>
    44  
    45 @@ -28,5 +29,10 @@
    46  int
    47  __fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
    48  {
    49 +#ifdef __NR_fallocate
    50    return __call_fallocate (fd, mode, offset, len);
    51 +#else
    52 +  __set_errno (ENOSYS);
    53 +  return -1;
    54 +#endif
    55  }