libc/uClibc: vampirise patches for 0.9.30.2 from builroot
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Feb 28 11:50:15 2010 +0100 (2010-02-28)
changeset 181966fcfb3d6745
parent 1818 533e48e6aa9e
child 1820 55adc838cd68
libc/uClibc: vampirise patches for 0.9.30.2 from builroot

Commit in upstream buildroot:
http://git.buildroot.org/buildroot/commit/?id=43ffd946ad569f3a1d0662de221cd4cb65bdc8e6
Everything on the 0_9_30 branch since the release (0.9.30.3 to be)
patches/uClibc/0.9.30.2/150-LT-pthread_atfork-unhide.patch
patches/uClibc/0.9.30.2/160-Make-use-of-macros-from-sys-asm.h-in-crt1.S.patch
patches/uClibc/0.9.30.2/170-Makefile.in-Make-install_dev-depend-on-install_runti.patch
patches/uClibc/0.9.30.2/180-Unbreak-build-for-sparc-on-some-config-s.patch
patches/uClibc/0.9.30.2/190-avr32-add-varargs-handling-of-prctl-syscall.patch
patches/uClibc/0.9.30.2/200-clean-up-O_CLOEXEC-handling.patch
patches/uClibc/0.9.30.2/210-fix-make-install-host-utils.patch
patches/uClibc/0.9.30.2/220-fstatat-fix-up-behavior-on-32-64-bit-hosts.patch
patches/uClibc/0.9.30.2/230-getdents-Fix-mips64-build.patch
patches/uClibc/0.9.30.2/240-host-utils-depend-on-headers.patch
patches/uClibc/0.9.30.2/250-libc-Fix-typo-in-include-rpc.patch
patches/uClibc/0.9.30.2/260-libm-enable-log2f-and-exp2f.patch
patches/uClibc/0.9.30.2/270-malloc-fix-race-condition-and-other-bugs-in-the-no-m.patch
patches/uClibc/0.9.30.2/280-rpc-fix-typo-in-version-mismatch-msg.patch
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/uClibc/0.9.30.2/150-LT-pthread_atfork-unhide.patch	Sun Feb 28 11:50:15 2010 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +From a05c4380c5aaa6e107a4c7e1e5a139ec4cc43f0c Mon Sep 17 00:00:00 2001
     1.5 +From: Henning Heinold <heinold@inf.fu-berlin.de>
     1.6 +Date: Sun, 21 Feb 2010 11:55:32 +0100
     1.7 +Subject: [PATCH 14/15] LT pthread_atfork: unhide
     1.8 +
     1.9 +Trying to compile perl with uClibc new linuxthreads on arm.
    1.10 +I run into the problem that pthread_atfork is not available.
    1.11 +The problem was that it was synced with the glibc version, which has
    1.12 +compat ifdefs we do not need in uClibc. The inital checked in version
    1.13 +is right and works. So either revert the commit 2 years ago
    1.14 +or patch it with the patch attached I made for openembedded.
    1.15 +
    1.16 +Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de>
    1.17 +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    1.18 +---
    1.19 + libpthread/linuxthreads/Makefile.in      |    2 +-
    1.20 + libpthread/linuxthreads/pthread_atfork.c |   13 +++----------
    1.21 + 2 files changed, 4 insertions(+), 11 deletions(-)
    1.22 +
    1.23 +diff --git a/libpthread/linuxthreads/Makefile.in b/libpthread/linuxthreads/Makefile.in
    1.24 +index 947dea9..d53b5fa 100644
    1.25 +--- a/libpthread/linuxthreads/Makefile.in
    1.26 ++++ b/libpthread/linuxthreads/Makefile.in
    1.27 +@@ -45,7 +45,7 @@ pthread_sysdep_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/pthread/%.c,$(pthre
    1.28 + pthread_SRC := \
    1.29 + 	attr barrier cancel condvar errno events join pthread \
    1.30 + 	lockfile manager mutex pt-machine ptcleanup \
    1.31 +-	ptclock_gettime ptclock_settime ptfork pthandles \
    1.32 ++	ptclock_gettime ptclock_settime ptfork pthandles pthread_atfork \
    1.33 + 	pthread_setegid pthread_seteuid pthread_setgid pthread_setregid \
    1.34 + 	pthread_setresgid pthread_setresuid pthread_setreuid pthread_setuid \
    1.35 + 	rwlock semaphore sighandler signals specific spinlock
    1.36 +diff --git a/libpthread/linuxthreads/pthread_atfork.c b/libpthread/linuxthreads/pthread_atfork.c
    1.37 +index 2464acb..4c83dd0 100644
    1.38 +--- a/libpthread/linuxthreads/pthread_atfork.c
    1.39 ++++ b/libpthread/linuxthreads/pthread_atfork.c
    1.40 +@@ -43,12 +43,8 @@ extern void *__dso_handle __attribute__ ((__weak__));
    1.41 + 
    1.42 + /* Hide the symbol so that no definition but the one locally in the
    1.43 +    executable or DSO is used.  */
    1.44 +-int
    1.45 +-#ifndef __pthread_atfork
    1.46 +-/* Don't mark the compatibility function as hidden.  */
    1.47 +-attribute_hidden
    1.48 +-#endif
    1.49 +-__pthread_atfork (prepare, parent, child)
    1.50 ++
    1.51 ++int attribute_hidden __pthread_atfork (prepare, parent, child)
    1.52 +      void (*prepare) (void);
    1.53 +      void (*parent) (void);
    1.54 +      void (*child) (void);
    1.55 +@@ -56,8 +52,5 @@ __pthread_atfork (prepare, parent, child)
    1.56 +   return __register_atfork (prepare, parent, child,
    1.57 + 			    &__dso_handle == NULL ? NULL : __dso_handle);
    1.58 + }
    1.59 +-#ifndef __pthread_atfork
    1.60 +-extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
    1.61 +-			   void (*child) (void)) attribute_hidden;
    1.62 ++
    1.63 + strong_alias (__pthread_atfork, pthread_atfork)
    1.64 +-#endif
    1.65 +-- 
    1.66 +1.6.6.1
    1.67 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/uClibc/0.9.30.2/160-Make-use-of-macros-from-sys-asm.h-in-crt1.S.patch	Sun Feb 28 11:50:15 2010 +0100
     2.3 @@ -0,0 +1,87 @@
     2.4 +From 2911103dd4a03bbd3aad11eddfce524a5c9ba9b3 Mon Sep 17 00:00:00 2001
     2.5 +From: Khem Raj <raj.khem@gmail.com>
     2.6 +Date: Fri, 22 Jan 2010 13:00:20 +0100
     2.7 +Subject: [PATCH 03/15] Make use of macros from sys/asm.h in crt1.S
     2.8 +
     2.9 +Needed for mips nptl to boot once again.
    2.10 +(cherry picked from commit 9c343fd4030dcd7a52616f365893177dded50346)
    2.11 +
    2.12 +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    2.13 +---
    2.14 + libc/sysdeps/linux/mips/crt1.S |   46 +++++++++++----------------------------
    2.15 + 1 files changed, 13 insertions(+), 33 deletions(-)
    2.16 +
    2.17 +diff --git a/libc/sysdeps/linux/mips/crt1.S b/libc/sysdeps/linux/mips/crt1.S
    2.18 +index e851d52..6a80412 100644
    2.19 +--- a/libc/sysdeps/linux/mips/crt1.S
    2.20 ++++ b/libc/sysdeps/linux/mips/crt1.S
    2.21 +@@ -85,29 +85,10 @@
    2.22 + 
    2.23 + __start:
    2.24 + #ifdef __PIC__
    2.25 +-#if _MIPS_SIM == _MIPS_SIM_ABI32
    2.26 +-	.frame	sp, 24, sp
    2.27 +-        .set noreorder
    2.28 +-	move $0, $31		/* Save old ra.  */
    2.29 +-	bal 10f			/* Find addr of cpload.  */
    2.30 +-        nop
    2.31 +-10:
    2.32 +-	.cpload $31
    2.33 +-	move $31, $0
    2.34 +-	.set reorder
    2.35 +-	.cprestore 16
    2.36 +-#else
    2.37 +-	move $0, $31; /* Save old ra.  */
    2.38 +-	.set noreorder
    2.39 +-	bal 10f /* Find addr of .cpsetup.  */
    2.40 +-	nop
    2.41 +-10:
    2.42 +-	.set reorder
    2.43 +-	.cpsetup $31, $25, 10b
    2.44 +-	move $31, $0
    2.45 +-#endif
    2.46 ++	SETUP_GPX($0)
    2.47 ++	SETUP_GPX64($25,$0)
    2.48 + #else
    2.49 +-	la $28, _gp             /* Setup GP correctly if we're non-PIC.  */
    2.50 ++	PTR_LA $28, _gp             /* Setup GP correctly if we're non-PIC.  */
    2.51 + 	move $31, $0
    2.52 + #endif
    2.53 + 
    2.54 +@@ -118,18 +99,18 @@ __start:
    2.55 + 	/* Allocate space on the stack for seven arguments and
    2.56 + 	 * make sure the stack is aligned to double words (8 bytes) */
    2.57 + 
    2.58 ++	and $29, -2 * SZREG
    2.59 ++
    2.60 + #if _MIPS_SIM == _MIPS_SIM_ABI32
    2.61 +-	and $29, -2 * 4
    2.62 +-	subu $29, 32
    2.63 +-	la $7, _init		/* init */
    2.64 +-	la $8, _fini
    2.65 +-	sw $8, 16($29)		/* fini */
    2.66 +-	sw $2, 20($29)		/* rtld_fini */
    2.67 +-	sw $29, 24($29)		/* stack_end */
    2.68 +-#else
    2.69 +-	and $29, -2 * PTRSIZE
    2.70 ++	PTR_SUBIU $29, 32
    2.71 ++#endif
    2.72 + 	PTR_LA $7, _init		/* init */
    2.73 +-	PTR_LA $8, _fini		/* fini */
    2.74 ++	PTR_LA $8, _fini
    2.75 ++#if _MIPS_SIM == _MIPS_SIM_ABI32
    2.76 ++	PTR_S $8, 16($29)		/* fini */
    2.77 ++	PTR_S $2, 20($29)		/* rtld_fini */
    2.78 ++	PTR_S $29, 24($29)		/* stack_end */
    2.79 ++#else
    2.80 + 	move $9, $2		/* rtld_fini */
    2.81 + 	move $10, $29		/* stack_end */
    2.82 + #endif
    2.83 +@@ -148,4 +129,3 @@ __data_start:
    2.84 + 	.weak data_start
    2.85 + 	data_start = __data_start
    2.86 + 
    2.87 +-
    2.88 +-- 
    2.89 +1.6.6.1
    2.90 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/uClibc/0.9.30.2/170-Makefile.in-Make-install_dev-depend-on-install_runti.patch	Sun Feb 28 11:50:15 2010 +0100
     3.3 @@ -0,0 +1,30 @@
     3.4 +From 323453d85ed29ccba7a81d884479188869cd64b7 Mon Sep 17 00:00:00 2001
     3.5 +From: Henning Heinold <heinold@inf.fu-berlin.de>
     3.6 +Date: Sat, 23 Jan 2010 21:29:42 -0800
     3.7 +Subject: [PATCH 13/15] Makefile.in: Make install_dev depend on install_runtime.
     3.8 +
     3.9 +* Helps in parallel build.
    3.10 +
    3.11 +Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de>
    3.12 +Signed-off-by: Khem Raj <raj.khem@gmail.com>
    3.13 +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    3.14 +---
    3.15 + Makefile.in |    2 +-
    3.16 + 1 files changed, 1 insertions(+), 1 deletions(-)
    3.17 +
    3.18 +diff --git a/Makefile.in b/Makefile.in
    3.19 +index ec4c28e..a889838 100644
    3.20 +--- a/Makefile.in
    3.21 ++++ b/Makefile.in
    3.22 +@@ -370,7 +370,7 @@ ifneq ($(UCLIBC_SUPPORT_AI_ADDRCONFIG),y)
    3.23 + endif
    3.24 + 
    3.25 + # Installs development library links.
    3.26 +-install_dev: install_headers all
    3.27 ++install_dev: install_headers install_runtime
    3.28 + 	$(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
    3.29 + 	-$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
    3.30 + ifeq ($(HAVE_SHARED),y)
    3.31 +-- 
    3.32 +1.6.6.1
    3.33 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/patches/uClibc/0.9.30.2/180-Unbreak-build-for-sparc-on-some-config-s.patch	Sun Feb 28 11:50:15 2010 +0100
     4.3 @@ -0,0 +1,42 @@
     4.4 +From 7b964170536951a260f7d552db99b428d1ea5026 Mon Sep 17 00:00:00 2001
     4.5 +From: Austin Foxley <austinf@cetoncorp.com>
     4.6 +Date: Wed, 3 Feb 2010 12:12:10 -0800
     4.7 +Subject: [PATCH 08/15] Unbreak build for sparc on some config's
     4.8 +
     4.9 +Thanks to rob@landley.net
    4.10 +
    4.11 +Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
    4.12 +---
    4.13 + libc/sysdeps/linux/sparc/sigaction.c |    9 ++++-----
    4.14 + 1 files changed, 4 insertions(+), 5 deletions(-)
    4.15 +
    4.16 +diff --git a/libc/sysdeps/linux/sparc/sigaction.c b/libc/sysdeps/linux/sparc/sigaction.c
    4.17 +index a22ac40..7140fd3 100644
    4.18 +--- a/libc/sysdeps/linux/sparc/sigaction.c
    4.19 ++++ b/libc/sysdeps/linux/sparc/sigaction.c
    4.20 +@@ -34,7 +34,8 @@ _syscall5(int, rt_sigaction, int, a, int, b, int, c, int, d, int, e);
    4.21 + static void __rt_sigreturn_stub(void);
    4.22 + static void __sigreturn_stub(void);
    4.23 + 
    4.24 +-int __libc_sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
    4.25 ++libc_hidden_proto(sigaction)
    4.26 ++int sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
    4.27 + {
    4.28 + 	int ret;
    4.29 + 	struct sigaction kact, koact;
    4.30 +@@ -65,10 +66,8 @@ int __libc_sigaction(int sig, const struct sigaction *act, struct sigaction *oac
    4.31 + 	return ret;
    4.32 + }
    4.33 + 
    4.34 +-#ifndef LIBC_SIGACTION
    4.35 +-weak_alias(__libc_sigaction,sigaction)
    4.36 +-libc_hidden_weak(sigaction)
    4.37 +-#endif
    4.38 ++libc_hidden_def(sigaction)
    4.39 ++weak_alias(sigaction,__libc_sigaction)
    4.40 + 
    4.41 + static void
    4.42 + __rt_sigreturn_stub(void)
    4.43 +-- 
    4.44 +1.6.6.1
    4.45 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/patches/uClibc/0.9.30.2/190-avr32-add-varargs-handling-of-prctl-syscall.patch	Sun Feb 28 11:50:15 2010 +0100
     5.3 @@ -0,0 +1,74 @@
     5.4 +From 85bc04d5436ca6c8a30a1ad28862260a04b8b3d5 Mon Sep 17 00:00:00 2001
     5.5 +From: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
     5.6 +Date: Wed, 16 Dec 2009 13:16:08 +0100
     5.7 +Subject: [PATCH 02/15] avr32: add varargs handling of prctl syscall
     5.8 +
     5.9 +prctl is defined to use varargs in the header file, hence it needs varargs
    5.10 +specific handling in the source. This patch properly handles the variodic
    5.11 +argument before the syscall is passed to the kernel for the AVR32 architecture.
    5.12 +
    5.13 +Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
    5.14 +---
    5.15 + libc/sysdeps/linux/avr32/Makefile.arch |    2 +-
    5.16 + libc/sysdeps/linux/avr32/prctl.c       |   36 ++++++++++++++++++++++++++++++++
    5.17 + 2 files changed, 37 insertions(+), 1 deletions(-)
    5.18 + create mode 100644 libc/sysdeps/linux/avr32/prctl.c
    5.19 +
    5.20 +diff --git a/libc/sysdeps/linux/avr32/Makefile.arch b/libc/sysdeps/linux/avr32/Makefile.arch
    5.21 +index bc5f625..98b85a7 100644
    5.22 +--- a/libc/sysdeps/linux/avr32/Makefile.arch
    5.23 ++++ b/libc/sysdeps/linux/avr32/Makefile.arch
    5.24 +@@ -5,7 +5,7 @@
    5.25 + # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
    5.26 + #
    5.27 + 
    5.28 +-CSRC	:= brk.c clone.c mmap.c sigaction.c
    5.29 ++CSRC	:= brk.c clone.c mmap.c prctl.c sigaction.c
    5.30 + 
    5.31 + SSRC	:= __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S	\
    5.32 + 		sigrestorer.S syscall.S vfork.S
    5.33 +diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c
    5.34 +new file mode 100644
    5.35 +index 0000000..4e146e3
    5.36 +--- /dev/null
    5.37 ++++ b/libc/sysdeps/linux/avr32/prctl.c
    5.38 +@@ -0,0 +1,36 @@
    5.39 ++/*
    5.40 ++ * prctl syscall for AVR32 Linux.
    5.41 ++ *
    5.42 ++ * Copyright (C) 2010 Atmel Corporation
    5.43 ++ *
    5.44 ++ * This file is subject to the terms and conditions of the GNU Lesser General
    5.45 ++ * Public License. See the file "COPYING.LIB" in the main directory of this
    5.46 ++ * archive for more details.
    5.47 ++ */
    5.48 ++#include <sys/syscall.h>
    5.49 ++#include <sys/prctl.h>
    5.50 ++#include <stdarg.h>
    5.51 ++
    5.52 ++#ifdef __NR_prctl
    5.53 ++#define __NR___syscall_prctl	__NR_prctl
    5.54 ++static inline _syscall5(int, __syscall_prctl, int, option, long, arg2,
    5.55 ++		long, arg3, long, arg4, long, arg5);
    5.56 ++
    5.57 ++int prctl(int __option, ...)
    5.58 ++{
    5.59 ++	long arg2;
    5.60 ++	long arg3;
    5.61 ++	long arg4;
    5.62 ++	long arg5;
    5.63 ++	va_list ap;
    5.64 ++
    5.65 ++	va_start(ap, __option);
    5.66 ++	arg2 = va_arg(ap, long);
    5.67 ++	arg3 = va_arg(ap, long);
    5.68 ++	arg4 = va_arg(ap, long);
    5.69 ++	arg5 = va_arg(ap, long);
    5.70 ++	va_end(ap);
    5.71 ++
    5.72 ++	return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5);
    5.73 ++}
    5.74 ++#endif
    5.75 +-- 
    5.76 +1.6.6.1
    5.77 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/patches/uClibc/0.9.30.2/200-clean-up-O_CLOEXEC-handling.patch	Sun Feb 28 11:50:15 2010 +0100
     6.3 @@ -0,0 +1,297 @@
     6.4 +From 74ca5695cd9913691192e075449b8be5794d50f0 Mon Sep 17 00:00:00 2001
     6.5 +From: Mike Frysinger <vapier@gentoo.org>
     6.6 +Date: Thu, 8 Oct 2009 02:51:55 +0000
     6.7 +Subject: [PATCH 12/15] clean up O_CLOEXEC handling
     6.8 +
     6.9 +Drop the "#ifndef O_CLOEXEC" cruft, enable O_CLOEXEC in most fcntl.h
    6.10 +headers, and import __ASSUME_O_CLOEXEC from glibc.
    6.11 +
    6.12 +Signed-off-by: Mike Frysinger <vapier@gentoo.org>
    6.13 +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    6.14 +---
    6.15 + libc/pwd_grp/lckpwdf.c                     |    8 +++++++-
    6.16 + libc/sysdeps/linux/alpha/bits/fcntl.h      |    2 --
    6.17 + libc/sysdeps/linux/arm/bits/fcntl.h        |    2 --
    6.18 + libc/sysdeps/linux/avr32/bits/fcntl.h      |    1 +
    6.19 + libc/sysdeps/linux/bfin/bits/fcntl.h       |    2 ++
    6.20 + libc/sysdeps/linux/cris/bits/fcntl.h       |    1 +
    6.21 + libc/sysdeps/linux/frv/bits/fcntl.h        |    2 ++
    6.22 + libc/sysdeps/linux/hppa/bits/fcntl.h       |    1 +
    6.23 + libc/sysdeps/linux/i386/bits/fcntl.h       |    2 --
    6.24 + libc/sysdeps/linux/ia64/bits/fcntl.h       |    2 --
    6.25 + libc/sysdeps/linux/m68k/bits/fcntl.h       |    1 +
    6.26 + libc/sysdeps/linux/microblaze/bits/fcntl.h |    2 ++
    6.27 + libc/sysdeps/linux/mips/bits/fcntl.h       |    1 +
    6.28 + libc/sysdeps/linux/powerpc/bits/fcntl.h    |    2 --
    6.29 + libc/sysdeps/linux/sh/bits/fcntl.h         |    2 --
    6.30 + libc/sysdeps/linux/sh64/bits/fcntl.h       |    2 ++
    6.31 + libc/sysdeps/linux/sparc/bits/fcntl.h      |    2 --
    6.32 + libc/sysdeps/linux/x86_64/bits/fcntl.h     |    2 --
    6.33 + libc/sysdeps/linux/xtensa/bits/fcntl.h     |    1 +
    6.34 + 19 files changed, 21 insertions(+), 17 deletions(-)
    6.35 +
    6.36 +diff --git a/libc/pwd_grp/lckpwdf.c b/libc/pwd_grp/lckpwdf.c
    6.37 +index 0b0fb47..aec6283 100644
    6.38 +--- a/libc/pwd_grp/lckpwdf.c
    6.39 ++++ b/libc/pwd_grp/lckpwdf.c
    6.40 +@@ -75,7 +75,7 @@ lckpwdf (void)
    6.41 +   /* Prevent problems caused by multiple threads.  */
    6.42 +   __UCLIBC_MUTEX_LOCK(mylock);
    6.43 + 
    6.44 +-  lock_fd = open (_PATH_PASSWD, O_WRONLY);
    6.45 ++  lock_fd = open (_PATH_PASSWD, O_WRONLY | O_CLOEXEC);
    6.46 +   if (lock_fd == -1) {
    6.47 +     /* Cannot create lock file.  */
    6.48 + 	goto DONE;
    6.49 +@@ -97,6 +97,12 @@ lckpwdf (void)
    6.50 + 	goto DONE;
    6.51 +   }
    6.52 + 
    6.53 ++#ifndef __ASSUME_O_CLOEXEC
    6.54 ++    /* Make sure file gets correctly closed when process finished.  */
    6.55 ++   fcntl (lock_fd, F_SETFD, FD_CLOEXEC);
    6.56 ++#endif
    6.57 ++
    6.58 ++
    6.59 +   /* Now we have to get exclusive write access.  Since multiple
    6.60 +      process could try this we won't stop when it first fails.
    6.61 +      Instead we set a timeout for the system call.  Once the timer
    6.62 +diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h
    6.63 +index 2a6b9ea..649c563 100644
    6.64 +--- a/libc/sysdeps/linux/alpha/bits/fcntl.h
    6.65 ++++ b/libc/sysdeps/linux/alpha/bits/fcntl.h
    6.66 +@@ -50,9 +50,7 @@
    6.67 + # define O_NOFOLLOW	0200000	/* Do not follow links.  */
    6.68 + # define O_DIRECT	02000000 /* Direct disk access.  */
    6.69 + # define O_NOATIME	04000000 /* Do not set atime.  */
    6.70 +-# if 0
    6.71 + # define O_CLOEXEC      010000000 /* Set close_on_exec.  */
    6.72 +-# endif
    6.73 + #endif
    6.74 + 
    6.75 + #ifdef __USE_LARGEFILE64
    6.76 +diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h
    6.77 +index 86cea4b..7cc5a9d 100644
    6.78 +--- a/libc/sysdeps/linux/arm/bits/fcntl.h
    6.79 ++++ b/libc/sysdeps/linux/arm/bits/fcntl.h
    6.80 +@@ -50,9 +50,7 @@
    6.81 + # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
    6.82 + # define O_DIRECT	0200000	/* Direct disk access.	*/
    6.83 + # define O_NOATIME     01000000 /* Do not set atime.  */
    6.84 +-# if 0
    6.85 + # define O_CLOEXEC     02000000 /* Set close_on_exec.  */
    6.86 +-# endif
    6.87 + #endif
    6.88 + 
    6.89 + /* For now Linux has synchronisity options for data and read operations.
    6.90 +diff --git a/libc/sysdeps/linux/avr32/bits/fcntl.h b/libc/sysdeps/linux/avr32/bits/fcntl.h
    6.91 +index 2301e22..767243e 100644
    6.92 +--- a/libc/sysdeps/linux/avr32/bits/fcntl.h
    6.93 ++++ b/libc/sysdeps/linux/avr32/bits/fcntl.h
    6.94 +@@ -30,6 +30,7 @@
    6.95 + # define O_DIRECTORY	00200000	/* direct disk access */
    6.96 + # define O_NOFOLLOW	00400000	/* don't follow links */
    6.97 + # define O_NOATIME	01000000	/* don't set atime */
    6.98 ++# define O_CLOEXEC	02000000	/* set close_on_exec */
    6.99 + #endif
   6.100 + 
   6.101 + #ifdef __USE_LARGEFILE64
   6.102 +diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h
   6.103 +index 7d0bcf9..aabf94d 100644
   6.104 +--- a/libc/sysdeps/linux/bfin/bits/fcntl.h
   6.105 ++++ b/libc/sysdeps/linux/bfin/bits/fcntl.h
   6.106 +@@ -48,6 +48,8 @@
   6.107 + # define O_DIRECTORY	 040000	/* Must be a directory.	 */
   6.108 + # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
   6.109 + # define O_DIRECT	0200000	/* Direct disk access.	*/
   6.110 ++# define O_NOATIME     01000000 /* don't set atime */
   6.111 ++# define O_CLOEXEC     02000000 /* set close_on_exec *
   6.112 + #endif
   6.113 + 
   6.114 + /* For now Linux has synchronisity options for data and read operations.
   6.115 +diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h
   6.116 +index a2106ef..29443ba 100644
   6.117 +--- a/libc/sysdeps/linux/cris/bits/fcntl.h
   6.118 ++++ b/libc/sysdeps/linux/cris/bits/fcntl.h
   6.119 +@@ -50,6 +50,7 @@
   6.120 + # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   6.121 + # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   6.122 + # define O_NOATIME	01000000 /* Do not set atime.  */
   6.123 ++# define O_CLOEXEC	02000000 /* set close_on_exec */
   6.124 + #endif
   6.125 + 
   6.126 + /* For now Linux has synchronisity options for data and read operations.
   6.127 +diff --git a/libc/sysdeps/linux/frv/bits/fcntl.h b/libc/sysdeps/linux/frv/bits/fcntl.h
   6.128 +index 06e8860..5bff4d3 100644
   6.129 +--- a/libc/sysdeps/linux/frv/bits/fcntl.h
   6.130 ++++ b/libc/sysdeps/linux/frv/bits/fcntl.h
   6.131 +@@ -45,6 +45,8 @@
   6.132 + # define O_DIRECT	 040000	/* Direct disk access.  */
   6.133 + # define O_DIRECTORY	0200000	/* Must be a directory.  */
   6.134 + # define O_NOFOLLOW	0400000	/* Do not follow links.  */
   6.135 ++# define O_NOATIME     01000000 /* don't set atime */
   6.136 ++# define O_CLOEXEC     02000000 /* set close_on_exec */
   6.137 + #endif
   6.138 + 
   6.139 + /* For now Linux has synchronisity options for data and read operations.
   6.140 +diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h
   6.141 +index cc23bf8..86e3b6f 100644
   6.142 +--- a/libc/sysdeps/linux/hppa/bits/fcntl.h
   6.143 ++++ b/libc/sysdeps/linux/hppa/bits/fcntl.h
   6.144 +@@ -50,6 +50,7 @@
   6.145 + # define O_DIRECTORY	00010000 /* Must be a directory. */
   6.146 + # define O_NOFOLLOW	00000200 /* Do not follow links. */
   6.147 + # define O_NOATIME	04000000 /* Do not set atime. */
   6.148 ++# define O_CLOEXEC	010000000 /* set close_on_exec */
   6.149 + #endif
   6.150 + 
   6.151 + #ifdef __USE_LARGEFILE64
   6.152 +diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h
   6.153 +index 7f0b552..22e073b 100644
   6.154 +--- a/libc/sysdeps/linux/i386/bits/fcntl.h
   6.155 ++++ b/libc/sysdeps/linux/i386/bits/fcntl.h
   6.156 +@@ -50,9 +50,7 @@
   6.157 + # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   6.158 + # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   6.159 + # define O_NOATIME     01000000 /* Do not set atime.  */
   6.160 +-# if 0
   6.161 + # define O_CLOEXEC     02000000 /* Set close_on_exec.  */
   6.162 +-# endif
   6.163 + #endif
   6.164 + 
   6.165 + /* For now Linux has synchronisity options for data and read operations.
   6.166 +diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h
   6.167 +index d134c4b..85a55f6 100644
   6.168 +--- a/libc/sysdeps/linux/ia64/bits/fcntl.h
   6.169 ++++ b/libc/sysdeps/linux/ia64/bits/fcntl.h
   6.170 +@@ -49,9 +49,7 @@
   6.171 + # define O_DIRECTORY	0200000	/* must be a directory */
   6.172 + # define O_NOFOLLOW	0400000 /* don't follow links */
   6.173 + # define O_NOATIME	01000000 /* Do not set atime.  */
   6.174 +-# if 0
   6.175 + # define O_CLOEXEC	02000000 /* Set close_on_exec.  */
   6.176 +-# endif
   6.177 + #endif
   6.178 + 
   6.179 + #ifdef __USE_LARGEFILE64
   6.180 +diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h
   6.181 +index d36198d..e564b42 100644
   6.182 +--- a/libc/sysdeps/linux/m68k/bits/fcntl.h
   6.183 ++++ b/libc/sysdeps/linux/m68k/bits/fcntl.h
   6.184 +@@ -49,6 +49,7 @@
   6.185 + # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
   6.186 + # define O_DIRECT	0200000	/* Direct disk access.	*/
   6.187 + # define O_NOATIME	01000000 /* Do not set atime.  */
   6.188 ++# define O_CLOEXEC	02000000 /* set close_on_exec */
   6.189 + #endif
   6.190 + 
   6.191 + /* For now Linux has synchronisity options for data and read operations.
   6.192 +diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h
   6.193 +index c8aeb91..da35209 100644
   6.194 +--- a/libc/sysdeps/linux/microblaze/bits/fcntl.h
   6.195 ++++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h
   6.196 +@@ -45,6 +45,8 @@
   6.197 + # define O_DIRECTORY	 040000	/* Must be a directory.	 */
   6.198 + # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
   6.199 + # define O_DIRECT	0200000	/* Direct disk access.	*/
   6.200 ++# define O_NOATIME     01000000 /* Do not set atime.  */
   6.201 ++# define O_CLOEXEC     02000000 /* set close_on_exec */
   6.202 + #endif
   6.203 + 
   6.204 + /* For now Linux has synchronisity options for data and read operations.
   6.205 +diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h
   6.206 +index ef015a4..f0072fd 100644
   6.207 +--- a/libc/sysdeps/linux/mips/bits/fcntl.h
   6.208 ++++ b/libc/sysdeps/linux/mips/bits/fcntl.h
   6.209 +@@ -51,6 +51,7 @@
   6.210 + # define O_DIRECT	0x8000	/* Direct disk access hint.  */
   6.211 + # define O_DIRECTORY	0x10000	/* Must be a directory.	 */
   6.212 + # define O_NOATIME	0x40000	/* Do not set atime.  */
   6.213 ++# define O_CLOEXEC	02000000 /* set close_on_exec */
   6.214 + #endif
   6.215 + 
   6.216 + /* For now Linux has no synchronisity options for data and read operations.
   6.217 +diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h
   6.218 +index ceb75b4..0759c6a 100644
   6.219 +--- a/libc/sysdeps/linux/powerpc/bits/fcntl.h
   6.220 ++++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h
   6.221 +@@ -50,9 +50,7 @@
   6.222 + # define O_DIRECTORY	 040000	/* Must be a directory.	 */
   6.223 + # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
   6.224 + # define O_NOATIME	01000000 /* Do not set atime.  */
   6.225 +-# if 0
   6.226 + # define O_CLOEXEC	02000000 /* Set close_on_exec.  */
   6.227 +-# endif
   6.228 + #endif
   6.229 + 
   6.230 + #ifdef __USE_LARGEFILE64
   6.231 +diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h
   6.232 +index 570484c..adb7377 100644
   6.233 +--- a/libc/sysdeps/linux/sh/bits/fcntl.h
   6.234 ++++ b/libc/sysdeps/linux/sh/bits/fcntl.h
   6.235 +@@ -50,9 +50,7 @@
   6.236 + # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   6.237 + # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   6.238 + # define O_NOATIME     01000000 /* Do not set atime.  */
   6.239 +-# if 0
   6.240 + # define O_CLOEXEC     02000000 /* Set close_on_exec.  */
   6.241 +-# endif
   6.242 + #endif
   6.243 + 
   6.244 + /* For now Linux has synchronisity options for data and read operations.
   6.245 +diff --git a/libc/sysdeps/linux/sh64/bits/fcntl.h b/libc/sysdeps/linux/sh64/bits/fcntl.h
   6.246 +index 06e8860..245d35a 100644
   6.247 +--- a/libc/sysdeps/linux/sh64/bits/fcntl.h
   6.248 ++++ b/libc/sysdeps/linux/sh64/bits/fcntl.h
   6.249 +@@ -45,6 +45,8 @@
   6.250 + # define O_DIRECT	 040000	/* Direct disk access.  */
   6.251 + # define O_DIRECTORY	0200000	/* Must be a directory.  */
   6.252 + # define O_NOFOLLOW	0400000	/* Do not follow links.  */
   6.253 ++# define O_NOATIME     01000000 /* Do not set atime.  */
   6.254 ++# define O_CLOEXEC     02000000 /* set close_on_exec */
   6.255 + #endif
   6.256 + 
   6.257 + /* For now Linux has synchronisity options for data and read operations.
   6.258 +diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h
   6.259 +index 29c09a9..31a6d9b 100644
   6.260 +--- a/libc/sysdeps/linux/sparc/bits/fcntl.h
   6.261 ++++ b/libc/sysdeps/linux/sparc/bits/fcntl.h
   6.262 +@@ -49,9 +49,7 @@
   6.263 + # define O_NOFOLLOW	0x20000 /* don't follow links */
   6.264 + # define O_DIRECT	0x100000 /* direct disk access hint */
   6.265 + # define O_NOATIME	0x200000 /* Do not set atime.  */
   6.266 +-# if 0
   6.267 + # define O_CLOEXEC	0x400000 /* Set close_on_exit.  */
   6.268 +-# endif
   6.269 + #endif
   6.270 + 
   6.271 + #ifdef __USE_LARGEFILE64
   6.272 +diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h
   6.273 +index be00e4a..f1cf388 100644
   6.274 +--- a/libc/sysdeps/linux/x86_64/bits/fcntl.h
   6.275 ++++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h
   6.276 +@@ -50,9 +50,7 @@
   6.277 + # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   6.278 + # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   6.279 + # define O_NOATIME     01000000 /* Do not set atime.  */
   6.280 +-# if 0
   6.281 + # define O_CLOEXEC     02000000 /* Set close_on_exec.  */
   6.282 +-# endif
   6.283 + #endif
   6.284 + 
   6.285 + /* For now Linux has synchronisity options for data and read operations.
   6.286 +diff --git a/libc/sysdeps/linux/xtensa/bits/fcntl.h b/libc/sysdeps/linux/xtensa/bits/fcntl.h
   6.287 +index a89362e..921a626 100644
   6.288 +--- a/libc/sysdeps/linux/xtensa/bits/fcntl.h
   6.289 ++++ b/libc/sysdeps/linux/xtensa/bits/fcntl.h
   6.290 +@@ -50,6 +50,7 @@
   6.291 + # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   6.292 + # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   6.293 + # define O_NOATIME     01000000 /* Do not set atime.  */
   6.294 ++# define O_CLOEXEC     02000000 /* set close_on_exec */
   6.295 + #endif
   6.296 + 
   6.297 + /* For now Linux has synchronisity options for data and read operations.
   6.298 +-- 
   6.299 +1.6.6.1
   6.300 +
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/patches/uClibc/0.9.30.2/210-fix-make-install-host-utils.patch	Sun Feb 28 11:50:15 2010 +0100
     7.3 @@ -0,0 +1,153 @@
     7.4 +From d75ad2e129b3f22296cead3db53c784527deab60 Mon Sep 17 00:00:00 2001
     7.5 +From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
     7.6 +Date: Fri, 18 Sep 2009 14:07:31 +0000
     7.7 +Subject: fix make {,install_}{,host}utils
     7.8 +
     7.9 +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    7.10 +---
    7.11 +diff --git a/extra/locale/programs/locale.c b/extra/locale/programs/locale.c
    7.12 +index 462a579..dfd2029 100644
    7.13 +--- a/extra/locale/programs/locale.c
    7.14 ++++ b/extra/locale/programs/locale.c
    7.15 +@@ -10,10 +10,9 @@
    7.16 +  *
    7.17 +  */
    7.18 + 
    7.19 +-
    7.20 ++#include <string.h>
    7.21 + #include <stdio.h>
    7.22 + #include <stdlib.h>
    7.23 +-#include <string.h>
    7.24 + #include <langinfo.h>
    7.25 + #include <unistd.h>
    7.26 + #ifdef __UCLIBC_HAS_GETOPT_LONG__
    7.27 +diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
    7.28 +index 290e680..3ce884d 100644
    7.29 +--- a/libc/misc/wchar/wchar.c
    7.30 ++++ b/libc/misc/wchar/wchar.c
    7.31 +@@ -171,7 +171,6 @@ extern size_t _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn,
    7.32 + 
    7.33 + extern size_t _wchar_wcsntoutf8s(char *__restrict s, size_t n,
    7.34 + 					const wchar_t **__restrict src, size_t wn) attribute_hidden;
    7.35 +-
    7.36 + #endif /* _LIBC */
    7.37 + /**********************************************************************/
    7.38 + #ifdef L_btowc
    7.39 +@@ -1201,45 +1200,6 @@ typedef struct {
    7.40 + 	int skip_invalid_input;		/* To support iconv -c option. */
    7.41 + } _UC_iconv_t;
    7.42 + 
    7.43 +-
    7.44 +-
    7.45 +-#ifdef L_iconv
    7.46 +-
    7.47 +-#include <iconv.h>
    7.48 +-#include <string.h>
    7.49 +-#include <endian.h>
    7.50 +-#include <byteswap.h>
    7.51 +-
    7.52 +-#if (__BYTE_ORDER != __BIG_ENDIAN) && (__BYTE_ORDER != __LITTLE_ENDIAN)
    7.53 +-#error unsupported endianness for iconv
    7.54 +-#endif
    7.55 +-
    7.56 +-#ifndef __CTYPE_HAS_8_BIT_LOCALES
    7.57 +-#error currently iconv requires 8 bit locales
    7.58 +-#endif
    7.59 +-#ifndef __CTYPE_HAS_UTF_8_LOCALES
    7.60 +-#error currently iconv requires UTF-8 locales
    7.61 +-#endif
    7.62 +-
    7.63 +-
    7.64 +-enum {
    7.65 +-	IC_WCHAR_T = 0xe0,
    7.66 +-	IC_MULTIBYTE = 0xe0,
    7.67 +-#if __BYTE_ORDER == __BIG_ENDIAN
    7.68 +-	IC_UCS_4 =	0xec,
    7.69 +-	IC_UTF_32 = 0xe4,
    7.70 +-	IC_UCS_2 =	0xe2,
    7.71 +-	IC_UTF_16 = 0xea,
    7.72 +-#else
    7.73 +-	IC_UCS_4 =	0xed,
    7.74 +-	IC_UTF_32 = 0xe5,
    7.75 +-	IC_UCS_2 =	0xe3,
    7.76 +-	IC_UTF_16 = 0xeb,
    7.77 +-#endif
    7.78 +-	IC_UTF_8 = 2,
    7.79 +-	IC_ASCII = 1
    7.80 +-};
    7.81 +-
    7.82 + /* For the multibyte
    7.83 +  * bit 0 means swap endian
    7.84 +  * bit 1 means 2 byte
    7.85 +@@ -1247,8 +1207,13 @@ enum {
    7.86 +  *
    7.87 +  */
    7.88 + 
    7.89 ++#if defined L_iconv && defined _LIBC
    7.90 ++/* Used externally only by iconv utility */
    7.91 + extern const unsigned char __iconv_codesets[];
    7.92 + libc_hidden_proto(__iconv_codesets)
    7.93 ++#endif
    7.94 ++
    7.95 ++#if defined L_iconv || defined L_iconv_main
    7.96 + const unsigned char __iconv_codesets[] =
    7.97 + 	"\x0a\xe0""WCHAR_T\x00"		/* superset of UCS-4 but platform-endian */
    7.98 + #if __BYTE_ORDER == __BIG_ENDIAN
    7.99 +@@ -1281,7 +1246,48 @@ const unsigned char __iconv_codesets[] =
   7.100 + 	"\x08\x02""UTF-8\x00"
   7.101 + 	"\x0b\x01""US-ASCII\x00"
   7.102 + 	"\x07\x01""ASCII";			/* Must be last! (special case to save a nul) */
   7.103 ++#endif
   7.104 ++#if defined L_iconv && defined _LIBC
   7.105 + libc_hidden_data_def(__iconv_codesets)
   7.106 ++#endif
   7.107 ++
   7.108 ++
   7.109 ++#ifdef L_iconv
   7.110 ++
   7.111 ++#include <iconv.h>
   7.112 ++#include <string.h>
   7.113 ++#include <endian.h>
   7.114 ++#include <byteswap.h>
   7.115 ++
   7.116 ++#if (__BYTE_ORDER != __BIG_ENDIAN) && (__BYTE_ORDER != __LITTLE_ENDIAN)
   7.117 ++#error unsupported endianness for iconv
   7.118 ++#endif
   7.119 ++
   7.120 ++#ifndef __CTYPE_HAS_8_BIT_LOCALES
   7.121 ++#error currently iconv requires 8 bit locales
   7.122 ++#endif
   7.123 ++#ifndef __CTYPE_HAS_UTF_8_LOCALES
   7.124 ++#error currently iconv requires UTF-8 locales
   7.125 ++#endif
   7.126 ++
   7.127 ++
   7.128 ++enum {
   7.129 ++	IC_WCHAR_T = 0xe0,
   7.130 ++	IC_MULTIBYTE = 0xe0,
   7.131 ++#if __BYTE_ORDER == __BIG_ENDIAN
   7.132 ++	IC_UCS_4 =	0xec,
   7.133 ++	IC_UTF_32 = 0xe4,
   7.134 ++	IC_UCS_2 =	0xe2,
   7.135 ++	IC_UTF_16 = 0xea,
   7.136 ++#else
   7.137 ++	IC_UCS_4 =	0xed,
   7.138 ++	IC_UTF_32 = 0xe5,
   7.139 ++	IC_UCS_2 =	0xe3,
   7.140 ++	IC_UTF_16 = 0xeb,
   7.141 ++#endif
   7.142 ++	IC_UTF_8 = 2,
   7.143 ++	IC_ASCII = 1
   7.144 ++};
   7.145 + 
   7.146 + /* Experimentally off - libc_hidden_proto(strcasecmp) */
   7.147 + 
   7.148 +@@ -1575,6 +1581,4 @@ size_t weak_function iconv(iconv_t cd, char **__restrict inbuf,
   7.149 + 	}
   7.150 + 	return nrcount;
   7.151 + }
   7.152 +-
   7.153 + #endif
   7.154 +-
   7.155 +--
   7.156 +cgit v0.8.2.1
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/patches/uClibc/0.9.30.2/220-fstatat-fix-up-behavior-on-32-64-bit-hosts.patch	Sun Feb 28 11:50:15 2010 +0100
     8.3 @@ -0,0 +1,113 @@
     8.4 +From d43f068e84513ed88392df4ca27d49ad01145fd2 Mon Sep 17 00:00:00 2001
     8.5 +From: Mike Frysinger <vapier@gentoo.org>
     8.6 +Date: Sun, 6 Sep 2009 12:12:12 -0400
     8.7 +Subject: [PATCH 07/15] fstatat: fix up behavior on 32/64 bit hosts
     8.8 +MIME-Version: 1.0
     8.9 +Content-Type: text/plain; charset=UTF-8
    8.10 +Content-Transfer-Encoding: 8bit
    8.11 +
    8.12 +The fstatat() syscall is a little funky in that it sometimes changes name
    8.13 +between 32 and 64 bit hosts, but it should always operate on a 64bit stat
    8.14 +structure.  So for the fstatat() function, make sure we convert it from a
    8.15 +64bit kstat to a 32bit stat.
    8.16 +
    8.17 +Along these lines, we need to restore the __xstat32_conv() function.
    8.18 +
    8.19 +Reported-by: Timo Teräs <timo.teras@iki.fi>
    8.20 +Signed-off-by: Mike Frysinger <vapier@gentoo.org>
    8.21 +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    8.22 +---
    8.23 + libc/sysdeps/linux/common/fstatat.c   |    9 +++++++--
    8.24 + libc/sysdeps/linux/common/fstatat64.c |    5 +++++
    8.25 + libc/sysdeps/linux/common/xstatconv.c |   19 +++++++++++++++++++
    8.26 + libc/sysdeps/linux/common/xstatconv.h |    1 +
    8.27 + 4 files changed, 32 insertions(+), 2 deletions(-)
    8.28 +
    8.29 +diff --git a/libc/sysdeps/linux/common/fstatat.c b/libc/sysdeps/linux/common/fstatat.c
    8.30 +index 149c189..33daa7c 100644
    8.31 +--- a/libc/sysdeps/linux/common/fstatat.c
    8.32 ++++ b/libc/sysdeps/linux/common/fstatat.c
    8.33 +@@ -10,15 +10,20 @@
    8.34 + #include <sys/stat.h>
    8.35 + #include "xstatconv.h"
    8.36 + 
    8.37 ++/* 64bit ports tend to favor newfstatat() */
    8.38 ++#ifdef __NR_newfstatat
    8.39 ++# define __NR_fstatat64 __NR_newfstatat
    8.40 ++#endif
    8.41 ++
    8.42 + #ifdef __NR_fstatat64
    8.43 + int fstatat(int fd, const char *file, struct stat *buf, int flag)
    8.44 + {
    8.45 + 	int ret;
    8.46 +-	struct kernel_stat kbuf;
    8.47 ++	struct kernel_stat64 kbuf;
    8.48 + 
    8.49 + 	ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
    8.50 + 	if (ret == 0)
    8.51 +-		__xstat_conv(&kbuf, buf);
    8.52 ++		__xstat32_conv(&kbuf, buf);
    8.53 + 
    8.54 + 	return ret;
    8.55 + }
    8.56 +diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c
    8.57 +index 5ae1fad..95627af 100644
    8.58 +--- a/libc/sysdeps/linux/common/fstatat64.c
    8.59 ++++ b/libc/sysdeps/linux/common/fstatat64.c
    8.60 +@@ -12,6 +12,11 @@
    8.61 + 
    8.62 + #ifdef __UCLIBC_HAS_LFS__
    8.63 + 
    8.64 ++/* 64bit ports tend to favor newfstatat() */
    8.65 ++#ifdef __NR_newfstatat
    8.66 ++# define __NR_fstatat64 __NR_newfstatat
    8.67 ++#endif
    8.68 ++
    8.69 + #ifdef __NR_fstatat64
    8.70 + int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
    8.71 + {
    8.72 +diff --git a/libc/sysdeps/linux/common/xstatconv.c b/libc/sysdeps/linux/common/xstatconv.c
    8.73 +index e575b26..50455c6 100644
    8.74 +--- a/libc/sysdeps/linux/common/xstatconv.c
    8.75 ++++ b/libc/sysdeps/linux/common/xstatconv.c
    8.76 +@@ -46,6 +46,25 @@ void attribute_hidden __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
    8.77 + 	buf->st_ctim = kbuf->st_ctim;
    8.78 + }
    8.79 + 
    8.80 ++void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf)
    8.81 ++{
    8.82 ++	/* Convert to current kernel version of `struct stat64'. */
    8.83 ++	memset(buf, 0x00, sizeof(*buf));
    8.84 ++	buf->st_dev = kbuf->st_dev;
    8.85 ++	buf->st_ino = kbuf->st_ino;
    8.86 ++	buf->st_mode = kbuf->st_mode;
    8.87 ++	buf->st_nlink = kbuf->st_nlink;
    8.88 ++	buf->st_uid = kbuf->st_uid;
    8.89 ++	buf->st_gid = kbuf->st_gid;
    8.90 ++	buf->st_rdev = kbuf->st_rdev;
    8.91 ++	buf->st_size = kbuf->st_size;
    8.92 ++	buf->st_blksize = kbuf->st_blksize;
    8.93 ++	buf->st_blocks = kbuf->st_blocks;
    8.94 ++	buf->st_atim = kbuf->st_atim;
    8.95 ++	buf->st_mtim = kbuf->st_mtim;
    8.96 ++	buf->st_ctim = kbuf->st_ctim;
    8.97 ++}
    8.98 ++
    8.99 + #ifdef __UCLIBC_HAS_LFS__
   8.100 + 
   8.101 + void attribute_hidden __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf)
   8.102 +diff --git a/libc/sysdeps/linux/common/xstatconv.h b/libc/sysdeps/linux/common/xstatconv.h
   8.103 +index 57c8bcb..7568da8 100644
   8.104 +--- a/libc/sysdeps/linux/common/xstatconv.h
   8.105 ++++ b/libc/sysdeps/linux/common/xstatconv.h
   8.106 +@@ -26,6 +26,7 @@
   8.107 + #include <bits/kernel_stat.h>
   8.108 + 
   8.109 + extern void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf) attribute_hidden;
   8.110 ++extern void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf) attribute_hidden;
   8.111 + #if defined __UCLIBC_HAS_LFS__
   8.112 + extern void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf) attribute_hidden;
   8.113 + #endif
   8.114 +-- 
   8.115 +1.6.6.1
   8.116 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/patches/uClibc/0.9.30.2/230-getdents-Fix-mips64-build.patch	Sun Feb 28 11:50:15 2010 +0100
     9.3 @@ -0,0 +1,72 @@
     9.4 +From 13545bce877b33e30155fc412ad44cc118d83f77 Mon Sep 17 00:00:00 2001
     9.5 +From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
     9.6 +Date: Sat, 30 Jan 2010 00:24:37 +0900
     9.7 +Subject: [PATCH 15/15] getdents: Fix mips64 build
     9.8 +
     9.9 +On Wed, 27 Jan 2010 07:14:08 +0100, Carmelo AMOROSO <carmelo.amoroso@st.com> wrote:
    9.10 +> I would re-write your patch in a simpler way.
    9.11 +>
    9.12 +> We already have the following
    9.13 +>
    9.14 +> 136 #if defined __UCLIBC_HAS_LFS__ && ! defined __NR_getdents64
    9.15 +> 137 attribute_hidden strong_alias(__getdents,__getdents64)
    9.16 +> 138 #endif
    9.17 +>
    9.18 +> I think that it's simpler to move in the proper place this statement.
    9.19 +
    9.20 +Thanks, indeed.  If we came into "#elif WORDSIZE == 32" block, above
    9.21 +condition never be true.  So we can just move this statement out of
    9.22 +"#if...#elif...#elif...#endif" block.  Here is a revised patch.
    9.23 +
    9.24 +------------------------------------------------------
    9.25 +From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
    9.26 +Subject: [PATCH] getdents: Fix mips64 build
    9.27 +
    9.28 +Some archs (such as mips64) do not have getdents64 syscall but have
    9.29 +getdents syscall.  Define alias for it.
    9.30 +
    9.31 +This fixes regression from 0.9.30.1.
    9.32 +
    9.33 +Backgrounds:
    9.34 +This is once done by commit e8b1c674.  But after the commit 33bcf733
    9.35 +("Use getdents syscall if kernel provide supports for this instead of
    9.36 +relying upon getdents64."), if __ASSUME_GETDENTS32_D_TYPE was defined
    9.37 +the alias for getdents64 is not defined.  The macro
    9.38 +__ASSUME_GETDENTS32_D_TYPE had been effectively ignored until 0.9.30.1
    9.39 +but the commit 0f0f20ab ("Move kernel-features.h header from the
    9.40 +linuxthread directory to a common one...") really enables it.
    9.41 +
    9.42 +Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
    9.43 +Signed-off-by: Khem Raj <raj.khem@gmail.com>
    9.44 +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    9.45 +---
    9.46 + libc/sysdeps/linux/common/getdents.c |    8 ++++----
    9.47 + 1 files changed, 4 insertions(+), 4 deletions(-)
    9.48 +
    9.49 +diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
    9.50 +index b518cc0..66a03b3 100644
    9.51 +--- a/libc/sysdeps/linux/common/getdents.c
    9.52 ++++ b/libc/sysdeps/linux/common/getdents.c
    9.53 +@@ -136,10 +136,6 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
    9.54 +     return (char *) dp - buf;
    9.55 + }
    9.56 + 
    9.57 +-#if defined __UCLIBC_HAS_LFS__ && ! defined __NR_getdents64
    9.58 +-attribute_hidden strong_alias(__getdents,__getdents64)
    9.59 +-#endif
    9.60 +-
    9.61 + #elif __WORDSIZE == 32
    9.62 + 
    9.63 + /* Experimentally off - libc_hidden_proto(memmove) */
    9.64 +@@ -171,4 +167,8 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
    9.65 + }
    9.66 + #endif
    9.67 + 
    9.68 ++#if defined __UCLIBC_HAS_LFS__ && ! defined __NR_getdents64
    9.69 ++attribute_hidden strong_alias(__getdents,__getdents64)
    9.70 ++#endif
    9.71 ++
    9.72 + #endif
    9.73 +-- 
    9.74 +1.6.6.1
    9.75 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/patches/uClibc/0.9.30.2/240-host-utils-depend-on-headers.patch	Sun Feb 28 11:50:15 2010 +0100
    10.3 @@ -0,0 +1,35 @@
    10.4 +From 47e88c04e01299f975ff23f33035d0f34a8f6787 Mon Sep 17 00:00:00 2001
    10.5 +From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    10.6 +Date: Fri, 22 Jan 2010 13:32:44 +0100
    10.7 +Subject: [PATCH 06/15] {,host}utils depend on headers
    10.8 +
    10.9 +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
   10.10 +---
   10.11 + Makefile.in |    4 ++--
   10.12 + 1 files changed, 2 insertions(+), 2 deletions(-)
   10.13 +
   10.14 +diff --git a/Makefile.in b/Makefile.in
   10.15 +index 4c5aecb..ec4c28e 100644
   10.16 +--- a/Makefile.in
   10.17 ++++ b/Makefile.in
   10.18 +@@ -436,7 +436,7 @@ ifeq ($(HAVE_SHARED),y)
   10.19 + 	fi
   10.20 + endif
   10.21 + 
   10.22 +-utils:
   10.23 ++utils: headers
   10.24 + 	$(Q)$(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils $@
   10.25 + 
   10.26 + # Installs helper applications, such as 'ldd' and 'ldconfig'
   10.27 +@@ -445,7 +445,7 @@ install_utils: utils
   10.28 + 
   10.29 + endif # ifeq ($(HAVE_DOT_CONFIG),y)
   10.30 + 
   10.31 +-hostutils:
   10.32 ++hostutils: headers
   10.33 + 	$(Q)$(MAKE) CROSS="$(CROSS)" CC="$(CC)" HOSTCC="$(HOSTCC)" DOTHOST=.host -C utils $@
   10.34 + 
   10.35 + install_hostutils: hostutils
   10.36 +-- 
   10.37 +1.6.6.1
   10.38 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/patches/uClibc/0.9.30.2/250-libc-Fix-typo-in-include-rpc.patch	Sun Feb 28 11:50:15 2010 +0100
    11.3 @@ -0,0 +1,63 @@
    11.4 +From b4d6a6e94d87ff2b4ae687a21048833f19b9dd48 Mon Sep 17 00:00:00 2001
    11.5 +From: Carmelo Amoroso <carmelo.amoroso@st.com>
    11.6 +Date: Mon, 8 Feb 2010 16:24:06 +0100
    11.7 +Subject: [PATCH 11/15] libc: Fix typo in include/rpc
    11.8 +
    11.9 +s/GNU_SOUCE/GNU_SOURCE/ in include/rcp/
   11.10 +
   11.11 +Signed-off-by: Jason Woodward <jason.woodward@timesys.com>
   11.12 +Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
   11.13 +---
   11.14 + include/rpc/auth.h  |    4 ++--
   11.15 + include/rpc/rpc.h   |    4 ++--
   11.16 + include/rpc/types.h |    4 ++--
   11.17 + 3 files changed, 6 insertions(+), 6 deletions(-)
   11.18 +
   11.19 +diff --git a/include/rpc/auth.h b/include/rpc/auth.h
   11.20 +index 17eb59f..12297e6 100644
   11.21 +--- a/include/rpc/auth.h
   11.22 ++++ b/include/rpc/auth.h
   11.23 +@@ -47,8 +47,8 @@
   11.24 + #ifndef __FORCE_GLIBC
   11.25 + #define __FORCE_GLIBC
   11.26 + #endif
   11.27 +-#ifndef _GNU_SOUCE
   11.28 +-#define _GNU_SOUCE
   11.29 ++#ifndef _GNU_SOURCE
   11.30 ++#define _GNU_SOURCE
   11.31 + #endif
   11.32 + #define _(X)	X
   11.33 + #endif
   11.34 +diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
   11.35 +index 8194ffe..219910e 100644
   11.36 +--- a/include/rpc/rpc.h
   11.37 ++++ b/include/rpc/rpc.h
   11.38 +@@ -44,8 +44,8 @@
   11.39 + #ifndef __FORCE_GLIBC
   11.40 + #define __FORCE_GLIBC
   11.41 + #endif
   11.42 +-#ifndef _GNU_SOUCE
   11.43 +-#define _GNU_SOUCE
   11.44 ++#ifndef _GNU_SOURCE
   11.45 ++#define _GNU_SOURCE
   11.46 + #endif
   11.47 + #define _(X)	X
   11.48 + #include <features.h>
   11.49 +diff --git a/include/rpc/types.h b/include/rpc/types.h
   11.50 +index 469576e..05f49c3 100644
   11.51 +--- a/include/rpc/types.h
   11.52 ++++ b/include/rpc/types.h
   11.53 +@@ -39,8 +39,8 @@
   11.54 + #ifndef __FORCE_GLIBC
   11.55 + #define __FORCE_GLIBC
   11.56 + #endif
   11.57 +-#ifndef _GNU_SOUCE
   11.58 +-#define _GNU_SOUCE
   11.59 ++#ifndef _GNU_SOURCE
   11.60 ++#define _GNU_SOURCE
   11.61 + #endif
   11.62 + #define _(X)	X
   11.63 + #endif
   11.64 +-- 
   11.65 +1.6.6.1
   11.66 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/patches/uClibc/0.9.30.2/260-libm-enable-log2f-and-exp2f.patch	Sun Feb 28 11:50:15 2010 +0100
    12.3 @@ -0,0 +1,70 @@
    12.4 +From 956a0087e282e53ba9c085dbbc469391f7234944 Mon Sep 17 00:00:00 2001
    12.5 +From: Aurelien Jacobs <aurel@gnuage.org>
    12.6 +Date: Thu, 4 Feb 2010 09:31:40 -0800
    12.7 +Subject: [PATCH 10/15] libm: enable log2f and exp2f
    12.8 +
    12.9 +Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
   12.10 +Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
   12.11 +---
   12.12 + libm/float_wrappers.c    |    4 ++--
   12.13 + test/math/compile_test.c |    4 ++--
   12.14 + 2 files changed, 4 insertions(+), 4 deletions(-)
   12.15 +
   12.16 +diff --git a/libm/float_wrappers.c b/libm/float_wrappers.c
   12.17 +index dc315e7..b7317a1 100644
   12.18 +--- a/libm/float_wrappers.c
   12.19 ++++ b/libm/float_wrappers.c
   12.20 +@@ -15,12 +15,10 @@
   12.21 + 
   12.22 + /* For the time being, do _NOT_ implement these functions
   12.23 +  * that are defined by SuSv3 */
   12.24 +-#undef L_exp2f         /*float       exp2f(float);*/
   12.25 + #undef L_fdimf         /*float       fdimf(float, float);*/
   12.26 + #undef L_fmaf          /*float       fmaf(float, float, float);*/
   12.27 + #undef L_fmaxf         /*float       fmaxf(float, float);*/
   12.28 + #undef L_fminf         /*float       fminf(float, float);*/
   12.29 +-#undef L_log2f         /*float       log2f(float);*/
   12.30 + #undef L_nearbyintf    /*float       nearbyintf(float);*/
   12.31 + #undef L_nexttowardf   /*float       nexttowardf(float, long double);*/
   12.32 + #undef L_remquof       /*float       remquof(float, float, int *);*/
   12.33 +@@ -43,6 +41,7 @@ float       cosf(float);
   12.34 + float       coshf(float);
   12.35 + float       erfcf(float);
   12.36 + float       erff(float);
   12.37 ++float       exp2f(float);
   12.38 + float       expf(float);
   12.39 + float       expm1f(float);
   12.40 + float       fabsf(float);
   12.41 +@@ -56,6 +55,7 @@ float       lgammaf(float);
   12.42 + long long   llroundf(float);
   12.43 + float       log10f(float);
   12.44 + float       log1pf(float);
   12.45 ++float       log2f(float);
   12.46 + float       logbf(float);
   12.47 + float       logf(float);
   12.48 + long        lroundf(float);
   12.49 +diff --git a/test/math/compile_test.c b/test/math/compile_test.c
   12.50 +index 9990520..ee5e2e3 100644
   12.51 +--- a/test/math/compile_test.c
   12.52 ++++ b/test/math/compile_test.c
   12.53 +@@ -18,7 +18,7 @@ r += cosf(float_x);
   12.54 + r += coshf(float_x);
   12.55 + r += erfcf(float_x);
   12.56 + r += erff(float_x);
   12.57 +-/*r += exp2f(float_x); - uclibc does not have it (yet?) */
   12.58 ++r += exp2f(float_x);
   12.59 + r += expf(float_x);
   12.60 + r += expm1f(float_x);
   12.61 + r += fabsf(float_x);
   12.62 +@@ -38,7 +38,7 @@ r += llrintf(float_x);
   12.63 + r += llroundf(float_x);
   12.64 + r += log10f(float_x);
   12.65 + r += log1pf(float_x);
   12.66 +-/*r += log2f(float_x); - uclibc does not have it (yet?) */
   12.67 ++r += log2f(float_x);
   12.68 + r += logbf(float_x);
   12.69 + r += logf(float_x);
   12.70 + r += lrintf(float_x);
   12.71 +-- 
   12.72 +1.6.6.1
   12.73 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/patches/uClibc/0.9.30.2/270-malloc-fix-race-condition-and-other-bugs-in-the-no-m.patch	Sun Feb 28 11:50:15 2010 +0100
    13.3 @@ -0,0 +1,89 @@
    13.4 +From fa476d01f1c1990a92ee49d1f1c557b83805d0e9 Mon Sep 17 00:00:00 2001
    13.5 +From: Freeman Wang <xwang@ubicom.com>
    13.6 +Date: Sat, 19 Dec 2009 13:43:00 -0800
    13.7 +Subject: [PATCH 09/15] malloc: fix race condition and other bugs in the no-mmu malloc
    13.8 +
    13.9 +Fixes multiple race conditions on mmb list. This was done by
   13.10 +making the mmb_heap_lock into a recursive lock and making the
   13.11 +regular heap_lock extend to cover the mmb heap handling.
   13.12 +
   13.13 +Also move the new_mmb allocation up to before the mmb list is
   13.14 +iterated through to find the insertion point. When the mmb_heap
   13.15 +also runs out and needs to be extended when the regular heap is
   13.16 +just extended, the mmb list could be messed up.
   13.17 +
   13.18 +Signed-off-by: Freeman Wang <xwang@ubicom.com>
   13.19 +Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
   13.20 +---
   13.21 + libc/stdlib/malloc/free.c   |    6 +++---
   13.22 + libc/stdlib/malloc/malloc.c |    7 ++++---
   13.23 + 2 files changed, 7 insertions(+), 6 deletions(-)
   13.24 +
   13.25 +diff --git a/libc/stdlib/malloc/free.c b/libc/stdlib/malloc/free.c
   13.26 +index 90e18f4..741248a 100644
   13.27 +--- a/libc/stdlib/malloc/free.c
   13.28 ++++ b/libc/stdlib/malloc/free.c
   13.29 +@@ -179,14 +179,14 @@ __free_to_heap (void *mem, struct heap_free_area **heap
   13.30 + 	      /* Start searching again from the end of this block.  */
   13.31 + 	      start = mmb_end;
   13.32 + 
   13.33 ++	      /* Release the descriptor block we used.  */
   13.34 ++	      free_to_heap (mmb, &__malloc_mmb_heap, &__malloc_mmb_heap_lock);
   13.35 ++
   13.36 + 	      /* We have to unlock the heap before we recurse to free the mmb
   13.37 + 		 descriptor, because we might be unmapping from the mmb
   13.38 + 		 heap.  */
   13.39 +               __heap_unlock (heap_lock);
   13.40 + 
   13.41 +-	      /* Release the descriptor block we used.  */
   13.42 +-	      free_to_heap (mmb, &__malloc_mmb_heap, &__malloc_mmb_heap_lock);
   13.43 +-
   13.44 + 	      /* Do the actual munmap.  */
   13.45 + 	      munmap ((void *)mmb_start, mmb_end - mmb_start);
   13.46 + 
   13.47 +diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c
   13.48 +index 71f9e58..84a6acd 100644
   13.49 +--- a/libc/stdlib/malloc/malloc.c
   13.50 ++++ b/libc/stdlib/malloc/malloc.c
   13.51 +@@ -48,7 +48,7 @@ struct malloc_mmb *__malloc_mmapped_blocks = 0;
   13.52 + HEAP_DECLARE_STATIC_FREE_AREA (initial_mmb_fa, 48); /* enough for 3 mmbs */
   13.53 + struct heap_free_area *__malloc_mmb_heap = HEAP_INIT_WITH_FA (initial_mmb_fa);
   13.54 + #ifdef HEAP_USE_LOCKING
   13.55 +-pthread_mutex_t __malloc_mmb_heap_lock = PTHREAD_MUTEX_INITIALIZER;
   13.56 ++pthread_mutex_t __malloc_mmb_heap_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
   13.57 + #endif
   13.58 + #endif /* __UCLIBC_UCLINUX_BROKEN_MUNMAP__ */
   13.59 + 
   13.60 +@@ -151,19 +151,19 @@ __malloc_from_heap (size_t size, struct heap_free_area **heap
   13.61 + 	  /* Try again to allocate.  */
   13.62 + 	  mem = __heap_alloc (heap, &size);
   13.63 + 
   13.64 +-	  __heap_unlock (heap_lock);
   13.65 + 
   13.66 + #if !defined(MALLOC_USE_SBRK) && defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__)
   13.67 + 	  /* Insert a record of BLOCK in sorted order into the
   13.68 + 	     __malloc_mmapped_blocks list.  */
   13.69 + 
   13.70 ++	  new_mmb = malloc_from_heap (sizeof *new_mmb, &__malloc_mmb_heap, &__malloc_mmb_heap_lock);
   13.71 ++
   13.72 + 	  for (prev_mmb = 0, mmb = __malloc_mmapped_blocks;
   13.73 + 	       mmb;
   13.74 + 	       prev_mmb = mmb, mmb = mmb->next)
   13.75 + 	    if (block < mmb->mem)
   13.76 + 	      break;
   13.77 + 
   13.78 +-	  new_mmb = malloc_from_heap (sizeof *new_mmb, &__malloc_mmb_heap, &__malloc_mmb_heap_lock);
   13.79 + 	  new_mmb->next = mmb;
   13.80 + 	  new_mmb->mem = block;
   13.81 + 	  new_mmb->size = block_size;
   13.82 +@@ -177,6 +177,7 @@ __malloc_from_heap (size_t size, struct heap_free_area **heap
   13.83 + 			    (unsigned)new_mmb,
   13.84 + 			    (unsigned)new_mmb->mem, block_size);
   13.85 + #endif /* !MALLOC_USE_SBRK && __UCLIBC_UCLINUX_BROKEN_MUNMAP__ */
   13.86 ++	  __heap_unlock (heap_lock);
   13.87 + 	}
   13.88 +     }
   13.89 + 
   13.90 +-- 
   13.91 +1.6.6.1
   13.92 +
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/patches/uClibc/0.9.30.2/280-rpc-fix-typo-in-version-mismatch-msg.patch	Sun Feb 28 11:50:15 2010 +0100
    14.3 @@ -0,0 +1,26 @@
    14.4 +From 83a09cd5c9ed9afd87a7d1d17319c2fd2203ad0f Mon Sep 17 00:00:00 2001
    14.5 +From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    14.6 +Date: Thu, 21 Jan 2010 10:36:13 +0100
    14.7 +Subject: [PATCH 04/15] rpc: fix typo in version mismatch msg
    14.8 +
    14.9 +Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
   14.10 +---
   14.11 + libc/inet/rpc/rpc_prot.c |    2 +-
   14.12 + 1 files changed, 1 insertions(+), 1 deletions(-)
   14.13 +
   14.14 +diff --git a/libc/inet/rpc/rpc_prot.c b/libc/inet/rpc/rpc_prot.c
   14.15 +index 74658e6..229f988 100644
   14.16 +--- a/libc/inet/rpc/rpc_prot.c
   14.17 ++++ b/libc/inet/rpc/rpc_prot.c
   14.18 +@@ -229,7 +229,7 @@ rejected (enum reject_stat rjct_stat,
   14.19 + {
   14.20 +   switch (rjct_stat)
   14.21 +     {
   14.22 +-    case RPC_VERSMISMATCH:
   14.23 ++    case RPC_MISMATCH:
   14.24 +       error->re_status = RPC_VERSMISMATCH;
   14.25 +       return;
   14.26 +     case AUTH_ERROR:
   14.27 +-- 
   14.28 +1.6.6.1
   14.29 +