aboutsummaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32/0010-malloc-standard-synchronize-on-fork.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-12-23 16:30:18 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2011-12-23 16:33:50 +0100
commit293f29e8c45ca0fcb064107e275a477ad1913106 (patch)
treea79d2b2b93af581c861488f2bca773e4751288f0 /main/libc0.9.32/0010-malloc-standard-synchronize-on-fork.patch
parent453d9efbeb9055b3762960fb09894a04ded1495f (diff)
downloadaports-293f29e8c45ca0fcb064107e275a477ad1913106.tar.bz2
aports-293f29e8c45ca0fcb064107e275a477ad1913106.tar.xz
main/libc0.9.32: reorganize patches
We keep track of our patches in git now: http://git.alpinelinux.org/cgit/uClibc-alpine This is so its easier to keep track of upstream and make sure that our patches are upstreamed. we also bump pkgrel so we make sure we get the patches tested properly
Diffstat (limited to 'main/libc0.9.32/0010-malloc-standard-synchronize-on-fork.patch')
-rw-r--r--main/libc0.9.32/0010-malloc-standard-synchronize-on-fork.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/main/libc0.9.32/0010-malloc-standard-synchronize-on-fork.patch b/main/libc0.9.32/0010-malloc-standard-synchronize-on-fork.patch
new file mode 100644
index 0000000000..688231f777
--- /dev/null
+++ b/main/libc0.9.32/0010-malloc-standard-synchronize-on-fork.patch
@@ -0,0 +1,55 @@
+From 1bdf3d74afad552ff99182af70536f23549a434f 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>
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ 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.8
+