aboutsummaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-03-26 20:26:07 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-03-26 20:27:10 +0200
commit8e2d6ac68340a85895a7d5bfe323c4df3b4756ab (patch)
tree016f64c7020766fa2f676357f8f24db496ee7aa2 /main/libc0.9.32
parentc1936150c040193aa591283d0826b74ee244b9df (diff)
downloadaports-8e2d6ac68340a85895a7d5bfe323c4df3b4756ab.tar.bz2
aports-8e2d6ac68340a85895a7d5bfe323c4df3b4756ab.tar.xz
main/libc0.9.32: fix malloc for child process after fork
Diffstat (limited to 'main/libc0.9.32')
-rw-r--r--main/libc0.9.32/0001-malloc-standard-synchronize-on-fork.patch54
-rw-r--r--main/libc0.9.32/APKBUILD4
2 files changed, 57 insertions, 1 deletions
diff --git a/main/libc0.9.32/0001-malloc-standard-synchronize-on-fork.patch b/main/libc0.9.32/0001-malloc-standard-synchronize-on-fork.patch
new file mode 100644
index 0000000000..eb3bfbe04f
--- /dev/null
+++ b/main/libc0.9.32/0001-malloc-standard-synchronize-on-fork.patch
@@ -0,0 +1,54 @@
+From 168215f9c3ec4ec9a2fad9387038ced8b386ebaa Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Sat, 26 Mar 2011 20:23:09 +0200
+Subject: [PATCH] malloc-standard: synchronize on fork
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Otherwise other threads can leave malloc state locked, and the child
+will hang indefinitely if it tries to malloc something.
+
+Signed-off-by: Timo Teräs <timo.teras@iki.fi>
+---
+ libc/stdlib/malloc-standard/free.c | 17 +++++++++++++++++
+ 1 files changed, 17 insertions(+), 0 deletions(-)
+
+diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c
+index 39e54d6..df512cc 100644
+--- a/libc/stdlib/malloc-standard/free.c
++++ b/libc/stdlib/malloc-standard/free.c
+@@ -118,6 +118,21 @@ int malloc_trim(size_t pad)
+ to inline it at all call points, which turns out not to be an
+ optimization at all. (Inlining it in __malloc_consolidate is fine though.)
+ */
++static void _malloc_lock(void)
++{
++ __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(__malloc_lock);
++}
++
++static void _malloc_unlock(void)
++{
++ __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE(__malloc_lock);
++}
++
++static void _malloc_reset(void)
++{
++ __UCLIBC_MUTEX_INIT_VAR(__malloc_lock);
++}
++
+ static void malloc_init_state(mstate av)
+ {
+ int i;
+@@ -145,6 +160,8 @@ static void malloc_init_state(mstate av)
+
+ av->top = initial_top(av);
+ av->pagesize = malloc_getpagesize;
++
++ __libc_atfork(_malloc_lock, _malloc_unlock, _malloc_reset);
+ }
+
+
+--
+1.7.1
+
diff --git a/main/libc0.9.32/APKBUILD b/main/libc0.9.32/APKBUILD
index ac391d857a..507a6d68d3 100644
--- a/main/libc0.9.32/APKBUILD
+++ b/main/libc0.9.32/APKBUILD
@@ -4,7 +4,7 @@ pkgname=libc$_abiver
_gitver=
pkgver=0.9.32_rc3
_ver=${pkgver/_/-}
-pkgrel=2
+pkgrel=3
pkgdesc="C library for developing embedded Linux systems"
url=http://uclibc.org
license="LGPL-2"
@@ -25,6 +25,7 @@ source="http://uclibc.org/downloads/uClibc-${_ver}.tar.bz2
0002-stdlib-fix-arc4random-return-type-to-u_int32_t.patch
0003-ldso-support-RTLD_NOLOAD.patch
0001-libdl-rudimentary-locking-for-dlopen-dlsym-dlclose.patch
+ 0001-malloc-standard-synchronize-on-fork.patch
uclibcconfig.x86
uclibcconfig.x86_64
uclibcconfig.i486
@@ -126,6 +127,7 @@ bc164e262c5feab55c800780704fa71c 0001-ldso-limited-support-for-ORIGIN-in-rpath.
b4fb68ad3d0e8331b1b40c30eb21dfdc 0002-stdlib-fix-arc4random-return-type-to-u_int32_t.patch
6147efd2eee5af5e734896823c2d1a3d 0003-ldso-support-RTLD_NOLOAD.patch
3e151ae3d3613dff9296d166aca3a800 0001-libdl-rudimentary-locking-for-dlopen-dlsym-dlclose.patch
+30f27fe51fdc4d121166ad2af18dfb8d 0001-malloc-standard-synchronize-on-fork.patch
3f87dc1f171493f5fde3bf4ae7180b8a uclibcconfig.x86
be0a43796e418d2733d91f9888d213c3 uclibcconfig.x86_64
3f87dc1f171493f5fde3bf4ae7180b8a uclibcconfig.i486