diff options
author | d <> | 1999-02-01 07:58:30 +0000 |
---|---|---|
committer | d <> | 1999-02-01 07:58:30 +0000 |
commit | 3650b97f985fa923bd2059cdd3e8774fcb2ce8dd (patch) | |
tree | db0ce913c6538f4578b145caa033e322f87db29c /src | |
parent | 4865b13e8e7bce02c55a40a6d1e505a6485483b6 (diff) | |
download | openbsd-3650b97f985fa923bd2059cdd3e8774fcb2ce8dd.tar.gz openbsd-3650b97f985fa923bd2059cdd3e8774fcb2ce8dd.tar.bz2 openbsd-3650b97f985fa923bd2059cdd3e8774fcb2ce8dd.zip |
malloc can't use write() if it fails very early, so use the unwrapped syscall _thread_sys_write() if we are threaded
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index ecbf93dc48..55d00e5072 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #if defined(LIBC_SCCS) && !defined(lint) | 10 | #if defined(LIBC_SCCS) && !defined(lint) |
11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.33 1998/11/20 11:18:50 d Exp $"; | 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.34 1999/02/01 07:58:30 d Exp $"; |
12 | #endif /* LIBC_SCCS and not lint */ | 12 | #endif /* LIBC_SCCS and not lint */ |
13 | 13 | ||
14 | /* | 14 | /* |
@@ -102,6 +102,15 @@ static char rcsid[] = "$OpenBSD: malloc.c,v 1.33 1998/11/20 11:18:50 d Exp $"; | |||
102 | # define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&malloc_lock) | 102 | # define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&malloc_lock) |
103 | # define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&malloc_lock) | 103 | # define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&malloc_lock) |
104 | # define THREAD_LOCK_INIT() | 104 | # define THREAD_LOCK_INIT() |
105 | /* | ||
106 | * Malloc can't use the wrapped write() if it fails very early, so | ||
107 | * we use the unwrapped syscall _thread_sys_write() | ||
108 | */ | ||
109 | # define write _thread_sys_write | ||
110 | int write __P((int, const void *, size_t)); | ||
111 | # undef malloc | ||
112 | # undef realloc | ||
113 | # undef free | ||
105 | # endif | 114 | # endif |
106 | #else | 115 | #else |
107 | /* no threads */ | 116 | /* no threads */ |