aboutsummaryrefslogtreecommitdiff
path: root/malloc/malloc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-05-12 12:22:17 +0000
committerUlrich Drepper <drepper@redhat.com>1998-05-12 12:22:17 +0000
commitee74a442e8b9403f02f7e933260625acf145ad08 (patch)
tree1500526c0bc3f8bee1bbd5a2914e37d58e5d8bdc /malloc/malloc.c
parentde7e6366d6de7b1c8f8409af669b2c1e83d7307b (diff)
downloadglibc-ee74a442e8b9403f02f7e933260625acf145ad08.zip
glibc-ee74a442e8b9403f02f7e933260625acf145ad08.tar.gz
glibc-ee74a442e8b9403f02f7e933260625acf145ad08.tar.bz2
Update.
1998-05-12 12:15 Ulrich Drepper <drepper@cygnus.com> * posix/glob.c: Move to ... * sysdeps/generic/glob.c: ...here. * posix/glob.h (glob_t): Use correct types for gl_pathc and gl_offs elements. * sysdeps/unix/sysv/linux/alpha/glob.c: New file. * sysdeps/unix/sysv/linux/alpha/oldglob.c: New file. * sysdeps/unix/sysv/linux/alpha/Dist: Add oldglob.c. * sysdeps/unix/sysv/linux/alpha/Makefile: Compile oldglob in posix subdir. * libc.map [GLIBC_2.1]: Add glob and globfree. 1998-05-12 Ulrich Drepper <drepper@cygnus.com> * sunrpc/Makefile (generated): Restore old list. 1998-05-11 Andreas Jaeger <aj@arthur.rhein-neckar.de> * rt/Makefile (tests): Define only if we have a thread library. * nis/ypclnt.c: Add: #include <errno.h>. 1998-05-10 15:39 Zack Weinberg <zack@rabi.phys.columbia.edu> * configure.in: Define and substitute RELEASE as well as VERSION. * config.make.in: Add RELEASE and VERSION to be substituted. * Makeconfig: Delete all references to version.mk. * Make-dist: Likewise. * MakeTAGS: Likewise. * elf/Makefile: Likewise. 1998-05-10 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/ypclnt.c: Move "(none)" domainname check from __yp_check to yp_get_default_domain. 1998-05-12 Ulrich Drepper <drepper@cygnus.com> * sysdeps/posix/profil.c (__profil): Don't define act and timer variables as static. Patch by Joe Keane <jgk@jgk.org>. 1998-05-12 Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> * malloc/malloc.c: Fix for NO_THREADS case. Remove statfs and fstatfs. and pwrite as EXTRA. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r--malloc/malloc.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 78e6b39..4306a0a 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1195,11 +1195,13 @@ static Void_t* realloc_check(Void_t* oldmem, size_t bytes,
const Void_t *caller);
static Void_t* memalign_check(size_t alignment, size_t bytes,
const Void_t *caller);
+#ifndef NO_THREADS
static Void_t* malloc_starter(size_t sz, const Void_t *caller);
static void free_starter(Void_t* mem, const Void_t *caller);
static Void_t* malloc_atfork(size_t sz, const Void_t *caller);
static void free_atfork(Void_t* mem, const Void_t *caller);
#endif
+#endif
#else
@@ -1216,11 +1218,13 @@ static Void_t* malloc_check();
static void free_check();
static Void_t* realloc_check();
static Void_t* memalign_check();
+#ifndef NO_THREADS
static Void_t* malloc_starter();
static void free_starter();
static Void_t* malloc_atfork();
static void free_atfork();
#endif
+#endif
#endif
@@ -1533,6 +1537,8 @@ static unsigned long max_mmapped_mem = 0;
int __malloc_initialized = -1;
+#ifndef NO_THREADS
+
/* The following two functions are registered via thread_atfork() to
make sure that the mutexes remain in a consistent state in the
fork()ed version of a thread. Also adapt the malloc and free hooks
@@ -1605,6 +1611,8 @@ ptmalloc_init_all __MALLOC_P((void))
(void)mutex_init(&list_lock);
}
+#endif
+
/* Initialization routine. */
#if defined(_LIBC)
#if 0
@@ -1624,6 +1632,7 @@ ptmalloc_init __MALLOC_P((void))
if(__malloc_initialized >= 0) return;
__malloc_initialized = 0;
+#ifndef NO_THREADS
#if defined _LIBC || defined MALLOC_HOOKS
/* With some threads implementations, creating thread-specific data
or initializing a mutex may call malloc() itself. Provide a
@@ -1633,18 +1642,17 @@ ptmalloc_init __MALLOC_P((void))
__malloc_hook = malloc_starter;
__free_hook = free_starter;
#endif
-#if defined _LIBC && !defined NO_THREADS
+#ifdef _LIBC
/* Initialize the pthreads interface. */
if (__pthread_initialize != NULL)
__pthread_initialize();
#endif
-#ifndef NO_THREADS
mutex_init(&main_arena.mutex);
mutex_init(&list_lock);
tsd_key_create(&arena_key, NULL);
tsd_setspecific(arena_key, (Void_t *)&main_arena);
thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_init_all);
-#endif
+#endif /* !defined NO_THREADS */
#if defined _LIBC || defined MALLOC_HOOKS
if((s = getenv("MALLOC_TRIM_THRESHOLD_")))
mALLOPt(M_TRIM_THRESHOLD, atoi(s));
@@ -1655,8 +1663,10 @@ ptmalloc_init __MALLOC_P((void))
if((s = getenv("MALLOC_MMAP_MAX_")))
mALLOPt(M_MMAP_MAX, atoi(s));
s = getenv("MALLOC_CHECK_");
+#ifndef NO_THREADS
__malloc_hook = save_malloc_hook;
__free_hook = save_free_hook;
+#endif
if(s) {
if(s[0]) mALLOPt(M_CHECK_ACTION, (int)(s[0] - '0'));
__malloc_check_init();
@@ -4431,6 +4441,8 @@ memalign_check(alignment, bytes, caller)
return chunk2mem_check(p, bytes);
}
+#ifndef NO_THREADS
+
/* The following hooks are used when the global initialization in
ptmalloc_init() hasn't completed yet. */
@@ -4525,6 +4537,8 @@ free_atfork(mem, caller) Void_t* mem; const Void_t *caller;
(void)mutex_unlock(&ar_ptr->mutex);
}
+#endif
+
#endif /* defined _LIBC || defined MALLOC_HOOKS */