about summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-14 05:57:55 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-14 05:57:55 +0000
commit9869e6ec913e268748f510ab6ec64b8fd62531bc (patch)
treef3f8b9c049c73755d183cc1c1affd34ee8f9772b /malloc
parent3ee87ca7d4c813087eeee8b9fd04b7836244a54a (diff)
downloadglibc-9869e6ec913e268748f510ab6ec64b8fd62531bc.tar.gz
glibc-9869e6ec913e268748f510ab6ec64b8fd62531bc.tar.xz
glibc-9869e6ec913e268748f510ab6ec64b8fd62531bc.zip
Updated to fedora-glibc-20041014T0548
Diffstat (limited to 'malloc')
-rw-r--r--malloc/arena.c17
-rw-r--r--malloc/malloc.c6
2 files changed, 22 insertions, 1 deletions
diff --git a/malloc/arena.c b/malloc/arena.c
index 00f40971f3..9018a4f0e9 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -339,7 +339,16 @@ ptmalloc_init_minimal (void)
   mp_.pagesize       = malloc_getpagesize;
 }
 
+
 #ifdef _LIBC
+# ifdef SHARED
+static void *
+__failing_morecore (ptrdiff_t d)
+{
+  return (void *) MORECORE_FAILURE;
+}
+# endif
+
 # if defined SHARED && defined USE_TLS && !USE___THREAD
 # include <stdbool.h>
 
@@ -419,6 +428,14 @@ ptmalloc_init (void)
   mutex_init(&main_arena.mutex);
   main_arena.next = &main_arena;
 
+#if defined _LIBC && defined SHARED
+  /* In case this libc copy is in a non-default namespace, never use brk.  */
+  Dl_info di;
+  struct link_map *l;
+  if (_dl_addr (ptmalloc_init, &di, &l, NULL) != 0 && l->l_ns != LM_ID_BASE)
+    __morecore = __failing_morecore;
+#endif
+
   mutex_init(&list_lock);
   tsd_key_create(&arena_key, NULL);
   tsd_setspecific(arena_key, (Void_t *)&main_arena);
diff --git a/malloc/malloc.c b/malloc/malloc.c
index ad6009a198..2e91952a26 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -289,9 +289,13 @@ extern "C" {
 
 /* For writev and struct iovec.  */
 #include <sys/uio.h>
-  /* For syslog.  */
+/* For syslog.  */
 #include <sys/syslog.h>
 
+/* For various dynamic linking things.  */
+#include <dlfcn.h>
+
+
 /*
   Debugging: