diff --git a/lib/libc/compat/stdlib/compat_putenv.c b/lib/libc/compat/stdlib/compat_putenv.c index a234f82928af..8c8a128bd220 100644 --- a/lib/libc/compat/stdlib/compat_putenv.c +++ b/lib/libc/compat/stdlib/compat_putenv.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_putenv.c,v 1.2 2012/04/22 15:55:41 christos Exp $ */ +/* $NetBSD: compat_putenv.c,v 1.3 2015/01/20 18:31:24 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: compat_putenv.c,v 1.2 2012/04/22 15:55:41 christos Exp $"); +__RCSID("$NetBSD: compat_putenv.c,v 1.3 2015/01/20 18:31:24 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #define __LIBC12_SOURCE__ @@ -43,7 +43,6 @@ __RCSID("$NetBSD: compat_putenv.c,v 1.2 2012/04/22 15:55:41 christos Exp $"); #include #include "env.h" -#include "reentrant.h" #include "local.h" #ifdef __weak_alias diff --git a/lib/libc/compat/stdlib/compat_random.c b/lib/libc/compat/stdlib/compat_random.c index cde8b2d1e32a..b831d25ee209 100644 --- a/lib/libc/compat/stdlib/compat_random.c +++ b/lib/libc/compat/stdlib/compat_random.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_random.c,v 1.2 2014/06/12 18:50:12 christos Exp $ */ +/* $NetBSD: compat_random.c,v 1.3 2015/01/20 18:31:24 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: compat_random.c,v 1.2 2014/06/12 18:50:12 christos Exp $"); +__RCSID("$NetBSD: compat_random.c,v 1.3 2015/01/20 18:31:24 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #define __LIBC12_SOURCE__ @@ -41,7 +41,6 @@ __RCSID("$NetBSD: compat_random.c,v 1.2 2014/06/12 18:50:12 christos Exp $"); #include #include "env.h" -#include "reentrant.h" #include "local.h" #ifdef __weak_alias diff --git a/lib/libc/compat/stdlib/compat_unsetenv.c b/lib/libc/compat/stdlib/compat_unsetenv.c index 3c89812c9b4d..6043d6fc10c6 100644 --- a/lib/libc/compat/stdlib/compat_unsetenv.c +++ b/lib/libc/compat/stdlib/compat_unsetenv.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_unsetenv.c,v 1.3 2010/11/14 18:11:42 tron Exp $ */ +/* $NetBSD: compat_unsetenv.c,v 1.4 2015/01/20 18:31:24 christos Exp $ */ /* * Copyright (c) 1987, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)setenv.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: compat_unsetenv.c,v 1.3 2010/11/14 18:11:42 tron Exp $"); +__RCSID("$NetBSD: compat_unsetenv.c,v 1.4 2015/01/20 18:31:24 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -47,7 +47,6 @@ __RCSID("$NetBSD: compat_unsetenv.c,v 1.3 2010/11/14 18:11:42 tron Exp $"); #include #include #include -#include "reentrant.h" #include "local.h" #ifdef __weak_alias diff --git a/lib/libc/gdtoa/gdtoa_locks.c b/lib/libc/gdtoa/gdtoa_locks.c index 81f521ce8aeb..af02c089753f 100644 --- a/lib/libc/gdtoa/gdtoa_locks.c +++ b/lib/libc/gdtoa/gdtoa_locks.c @@ -1,4 +1,4 @@ -/* $NetBSD: gdtoa_locks.c,v 1.1 2006/01/25 15:36:13 kleink Exp $ */ +/* $NetBSD: gdtoa_locks.c,v 1.2 2015/01/20 18:31:25 christos Exp $ */ /* * Written by Klaus Klein , November 16, 2005. @@ -7,4 +7,6 @@ #include "gdtoaimp.h" +#ifdef _REENTRANT mutex_t __gdtoa_locks[2] = { MUTEX_INITIALIZER, MUTEX_INITIALIZER }; +#endif diff --git a/lib/libc/gen/arc4random.c b/lib/libc/gen/arc4random.c index 13700a1e34f2..751bff354706 100644 --- a/lib/libc/gen/arc4random.c +++ b/lib/libc/gen/arc4random.c @@ -1,4 +1,4 @@ -/* $NetBSD: arc4random.c,v 1.26 2014/11/16 20:33:04 riastradh Exp $ */ +/* $NetBSD: arc4random.c,v 1.27 2015/01/20 18:31:25 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -52,7 +52,7 @@ */ #include -__RCSID("$NetBSD: arc4random.c,v 1.26 2014/11/16 20:33:04 riastradh Exp $"); +__RCSID("$NetBSD: arc4random.c,v 1.27 2015/01/20 18:31:25 christos Exp $"); #include "namespace.h" #include "reentrant.h" @@ -123,7 +123,7 @@ rotate(uint32_t u, unsigned c) (c) += (d); (b) ^= (c); (b) = rotate((b), 12); \ (a) += (b); (d) ^= (a); (d) = rotate((d), 8); \ (c) += (d); (b) ^= (c); (b) = rotate((b), 7); \ -} while (0) +} while (/*CONSTCOND*/0) const uint8_t crypto_core_constant32[16] = "expand 32-byte k"; @@ -341,7 +341,7 @@ crypto_onetimestream(const void *seed, void *buf, size_t n) uint32_t nonce[crypto_core_INPUTBYTES / sizeof(uint32_t)] = {0}; uint8_t block[crypto_core_OUTPUTBYTES]; uint8_t *p8, *p32; - const uint8_t *nonce8 = (const uint8_t *)nonce; + const uint8_t *nonce8 = (const uint8_t *)(void *)nonce; size_t ni, nb, nf; /* @@ -355,8 +355,8 @@ crypto_onetimestream(const void *seed, void *buf, size_t n) * log_2 (o 2^(8 i)) = log_2 o + log_2 2^(8 i) * = log_2 o + 8 i. */ - __CTASSERT(CHAR_BIT*sizeof n <= - (ilog2(crypto_core_OUTPUTBYTES) + 8*crypto_core_INPUTBYTES)); + __CTASSERT(CHAR_BIT * sizeof n <= + (/*LINTED*/ilog2(crypto_core_OUTPUTBYTES) + 8 * crypto_core_INPUTBYTES)); p8 = buf; p32 = (uint8_t *)roundup2((uintptr_t)p8, 4); @@ -419,7 +419,7 @@ arc4random_prng_addrandom(struct arc4random_prng *prng, const void *data, crypto_prng_buf(&prng->arc4_prng, buf, sizeof buf); SHA256_Update(&ctx, buf, sizeof buf); - if (sysctl(mib, __arraycount(mib), buf, &buflen, NULL, 0) == -1) + if (sysctl(mib, (u_int)__arraycount(mib), buf, &buflen, NULL, 0) == -1) abort(); if (buflen != sizeof buf) abort(); @@ -476,11 +476,6 @@ arc4random_prng_destroy(struct arc4random_prng *prng) /* Library state */ -#if !defined(_REENTRANT) -#define mutex_lock(m) do {} while (0) -#define mutex_unlock(m) do {} while (0) -#endif - static struct arc4random_global { #ifdef _REENTRANT mutex_t lock; diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c index 3ef5858b4c97..01df5b1d1659 100644 --- a/lib/libc/gen/popen.c +++ b/lib/libc/gen/popen.c @@ -1,4 +1,4 @@ -/* $NetBSD: popen.c,v 1.33 2015/01/20 17:28:00 christos Exp $ */ +/* $NetBSD: popen.c,v 1.34 2015/01/20 18:31:25 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: popen.c,v 1.33 2015/01/20 17:28:00 christos Exp $"); +__RCSID("$NetBSD: popen.c,v 1.34 2015/01/20 18:31:25 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -57,7 +57,6 @@ __RCSID("$NetBSD: popen.c,v 1.33 2015/01/20 17:28:00 christos Exp $"); #include #include "env.h" -#include "reentrant.h" #ifdef __weak_alias __weak_alias(popen,_popen) diff --git a/lib/libc/gen/pthread_atfork.c b/lib/libc/gen/pthread_atfork.c index 25c27a7623b8..2d8252645a07 100644 --- a/lib/libc/gen/pthread_atfork.c +++ b/lib/libc/gen/pthread_atfork.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread_atfork.c,v 1.9 2012/03/20 16:36:05 matt Exp $ */ +/* $NetBSD: pthread_atfork.c,v 1.10 2015/01/20 18:31:25 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: pthread_atfork.c,v 1.9 2012/03/20 16:36:05 matt Exp $"); +__RCSID("$NetBSD: pthread_atfork.c,v 1.10 2015/01/20 18:31:25 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -61,7 +61,9 @@ struct atfork_callback { * across the fork, forking is going to be serialized anyway. */ static struct atfork_callback atfork_builtin; +#ifdef _REENTRANT static mutex_t atfork_lock = MUTEX_INITIALIZER; +#endif SIMPLEQ_HEAD(atfork_callback_q, atfork_callback); static struct atfork_callback_q prepareq = SIMPLEQ_HEAD_INITIALIZER(prepareq); diff --git a/lib/libc/include/env.h b/lib/libc/include/env.h index 20b6bf95ac29..72d506adc5ad 100644 --- a/lib/libc/include/env.h +++ b/lib/libc/include/env.h @@ -1,4 +1,4 @@ -/* $NetBSD: env.h,v 1.2 2010/11/14 22:04:36 tron Exp $ */ +/* $NetBSD: env.h,v 1.3 2015/01/20 18:31:25 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -56,7 +56,7 @@ __writelockenv(void) } static __inline bool -__unlocklockenv(void) +__unlockenv(void) { return true; } diff --git a/lib/libc/include/reentrant.h b/lib/libc/include/reentrant.h index a3f3fa0fed49..0850a49aff67 100644 --- a/lib/libc/include/reentrant.h +++ b/lib/libc/include/reentrant.h @@ -1,4 +1,4 @@ -/* $NetBSD: reentrant.h,v 1.17 2013/04/12 18:12:58 joerg Exp $ */ +/* $NetBSD: reentrant.h,v 1.18 2015/01/20 18:31:25 christos Exp $ */ /*- * Copyright (c) 1997, 1998, 2003 The NetBSD Foundation, Inc. @@ -278,31 +278,38 @@ __END_DECLS #else /* _REENTRANT */ -#define mutex_init(m, a) -#define mutex_lock(m) -#define mutex_trylock(m) -#define mutex_unlock(m) -#define mutex_destroy(m) +#ifndef __empty +#define __empty do {} while (/*CONSTCOND*/0) +#endif +#define mutex_init(m, a) __empty +#define mutex_lock(m) __empty +#define mutex_trylock(m) __empty +#define mutex_unlock(m) __empty +#define mutex_destroy(m) __empty -#define cond_init(c, t, a) -#define cond_signal(c) -#define cond_broadcast(c) -#define cond_wait(c, m) -#define cond_timedwait(c, m, t) -#define cond_destroy(c) +#define cond_init(c, t, a) __empty +#define cond_signal(c) __empty +#define cond_broadcast(c) __empty +#define cond_wait(c, m) __empty +#define cond_timedwait(c, m, t) __empty +#define cond_destroy(c) __empty -#define rwlock_init(l, a) -#define rwlock_rdlock(l) -#define rwlock_wrlock(l) -#define rwlock_tryrdlock(l) -#define rwlock_trywrlock(l) -#define rwlock_unlock(l) -#define rwlock_destroy(l) +#define rwlock_init(l, a) __empty +#define rwlock_rdlock(l) __empty +#define rwlock_wrlock(l) __empty +#define rwlock_tryrdlock(l) __empty +#define rwlock_trywrlock(l) __empty +#define rwlock_unlock(l) __empty +#define rwlock_destroy(l) __empty -#define thr_keycreate(k, d) -#define thr_setspecific(k, p) -#define thr_getspecific(k) -#define thr_keydelete(k) +#define thr_keycreate(k, d) /*LINTED*/0 +#define thr_setspecific(k, p) __empty +#define thr_getspecific(k) /*LINTED*/0 +#define thr_keydelete(k) __empty + +#define mutexattr_init(ma) __empty +#define mutexattr_settype(ma, t) __empty +#define mutexattr_destroy(ma) __empty static inline int thr_once(once_t *once_control, void (*routine)(void)) @@ -313,12 +320,12 @@ thr_once(once_t *once_control, void (*routine)(void)) } return 0; } -#define thr_sigsetmask(f, n, o) -#define thr_self() -#define thr_errno() +#define thr_sigsetmask(f, n, o) __empty +#define thr_self() __empty +#define thr_errno() __empty #define thr_curcpu() ((unsigned int)0) -#define FLOCKFILE(fp) -#define FUNLOCKFILE(fp) +#define FLOCKFILE(fp) __empty +#define FUNLOCKFILE(fp) __empty #endif /* _REENTRANT */ diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c index cd3bebf87355..3ac9fdbe3f68 100644 --- a/lib/libc/rpc/clnt_simple.c +++ b/lib/libc/rpc/clnt_simple.c @@ -1,4 +1,4 @@ -/* $NetBSD: clnt_simple.c,v 1.32 2013/03/11 20:19:29 tron Exp $ */ +/* $NetBSD: clnt_simple.c,v 1.33 2015/01/20 18:31:25 christos Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)clnt_simple.c 1.49 89/01/31 Copyr 1984 Sun Micro"; #else -__RCSID("$NetBSD: clnt_simple.c,v 1.32 2013/03/11 20:19:29 tron Exp $"); +__RCSID("$NetBSD: clnt_simple.c,v 1.33 2015/01/20 18:31:25 christos Exp $"); #endif #endif @@ -141,15 +141,12 @@ rpc_call( /* XXX: nettype may be NULL ??? */ #ifdef _REENTRANT - if (__isthreaded == 0) { - rcp = rpc_call_private_main; - } else { + if (__isthreaded) { thr_once(&rpc_call_once, rpc_call_setup); rcp = thr_getspecific(rpc_call_key); - } -#else - rcp = rpc_call_private_main; + } else #endif + rcp = rpc_call_private_main; if (rcp == NULL) { rcp = malloc(sizeof (*rcp)); if (rcp == NULL) { @@ -157,10 +154,12 @@ rpc_call( rpc_createerr.cf_error.re_errno = errno; return (rpc_createerr.cf_stat); } - if (__isthreaded == 0) - rpc_call_private_main = rcp; - else +#ifdef _REENTRANT + if (__isthreaded) thr_setspecific(rpc_call_key, (void *) rcp); + else +#endif + rpc_call_private_main = rcp; rcp->valid = 0; rcp->client = NULL; } diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c index f73b10999589..155996887043 100644 --- a/lib/libc/rpc/clnt_vc.c +++ b/lib/libc/rpc/clnt_vc.c @@ -1,4 +1,4 @@ -/* $NetBSD: clnt_vc.c,v 1.25 2014/01/21 17:39:24 christos Exp $ */ +/* $NetBSD: clnt_vc.c,v 1.26 2015/01/20 18:31:25 christos Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -38,7 +38,7 @@ static char *sccsid = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; static char *sccsid = "@(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC"; static char sccsid[] = "@(#)clnt_vc.c 1.19 89/03/16 Copyr 1988 Sun Micro"; #else -__RCSID("$NetBSD: clnt_vc.c,v 1.25 2014/01/21 17:39:24 christos Exp $"); +__RCSID("$NetBSD: clnt_vc.c,v 1.26 2015/01/20 18:31:25 christos Exp $"); #endif #endif @@ -662,12 +662,12 @@ clnt_vc_destroy(CLIENT *cl) _DIAGASSERT(cl != NULL); ct = (struct ct_data *) cl->cl_private; - ct_fd = ct->ct_fd; __clnt_sigfillset(&newmask); thr_sigsetmask(SIG_SETMASK, &newmask, &mask); mutex_lock(&clnt_fd_lock); #ifdef _REENTRANT + ct_fd = ct->ct_fd; while (vc_fd_locks[ct_fd]) cond_wait(&vc_cv[ct_fd], &clnt_fd_lock); #endif diff --git a/lib/libc/stdlib/_env.c b/lib/libc/stdlib/_env.c index 82a16c81e703..c7f32e46d49f 100644 --- a/lib/libc/stdlib/_env.c +++ b/lib/libc/stdlib/_env.c @@ -1,4 +1,4 @@ -/* $NetBSD: _env.c,v 1.8 2013/09/09 10:21:28 tron Exp $ */ +/* $NetBSD: _env.c,v 1.9 2015/01/20 18:31:25 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: _env.c,v 1.8 2013/09/09 10:21:28 tron Exp $"); +__RCSID("$NetBSD: _env.c,v 1.9 2015/01/20 18:31:25 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -46,7 +46,6 @@ __RCSID("$NetBSD: _env.c,v 1.8 2013/09/09 10:21:28 tron Exp $"); #include #include "env.h" -#include "reentrant.h" #include "local.h" /* diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c index d468f8f90f28..bcc72292043c 100644 --- a/lib/libc/stdlib/atexit.c +++ b/lib/libc/stdlib/atexit.c @@ -1,4 +1,4 @@ -/* $NetBSD: atexit.c,v 1.26 2013/08/19 22:14:37 matt Exp $ */ +/* $NetBSD: atexit.c,v 1.27 2015/01/20 18:31:25 christos Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: atexit.c,v 1.26 2013/08/19 22:14:37 matt Exp $"); +__RCSID("$NetBSD: atexit.c,v 1.27 2015/01/20 18:31:25 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #include "reentrant.h" @@ -120,10 +120,12 @@ atexit_handler_alloc(void *dso) void __section(".text.startup") __libc_atexit_init(void) { +#ifdef _REENTRANT mutexattr_t atexit_mutex_attr; mutexattr_init(&atexit_mutex_attr); mutexattr_settype(&atexit_mutex_attr, PTHREAD_MUTEX_RECURSIVE); mutex_init(&__atexit_mutex, &atexit_mutex_attr); +#endif } /* diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index ccd52e77ffb1..4d352c880d4a 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -1,4 +1,4 @@ -/* $NetBSD: getenv.c,v 1.35 2010/11/14 22:04:36 tron Exp $ */ +/* $NetBSD: getenv.c,v 1.36 2015/01/20 18:31:25 christos Exp $ */ /* * Copyright (c) 1987, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)getenv.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: getenv.c,v 1.35 2010/11/14 22:04:36 tron Exp $"); +__RCSID("$NetBSD: getenv.c,v 1.36 2015/01/20 18:31:25 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -45,7 +45,6 @@ __RCSID("$NetBSD: getenv.c,v 1.35 2010/11/14 22:04:36 tron Exp $"); #include #include "env.h" -#include "reentrant.h" #include "local.h" __weak_alias(getenv_r, _getenv_r) diff --git a/lib/libc/stdlib/jemalloc.c b/lib/libc/stdlib/jemalloc.c index 398c175bd96d..99cfff3bb522 100644 --- a/lib/libc/stdlib/jemalloc.c +++ b/lib/libc/stdlib/jemalloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: jemalloc.c,v 1.36 2014/09/19 17:42:19 matt Exp $ */ +/* $NetBSD: jemalloc.c,v 1.37 2015/01/20 18:31:25 christos Exp $ */ /*- * Copyright (C) 2006,2007 Jason Evans . @@ -118,7 +118,7 @@ #include /* __FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.147 2007/06/15 22:00:16 jasone Exp $"); */ -__RCSID("$NetBSD: jemalloc.c,v 1.36 2014/09/19 17:42:19 matt Exp $"); +__RCSID("$NetBSD: jemalloc.c,v 1.37 2015/01/20 18:31:25 christos Exp $"); #ifdef __FreeBSD__ #include "libc_private.h" @@ -392,9 +392,11 @@ static malloc_mutex_t init_lock = {_SPINLOCK_INITIALIZER}; /* Set to true once the allocator has been initialized. */ static bool malloc_initialized = false; +#ifdef _REENTRANT /* Used to avoid initialization races. */ static mutex_t init_lock = MUTEX_INITIALIZER; #endif +#endif /******************************************************************************/ /* @@ -704,8 +706,10 @@ static size_t arena_maxclass; /* Max size class for arenas. */ * Chunks. */ +#ifdef _REENTRANT /* Protects chunk-related data structures. */ static malloc_mutex_t chunks_mtx; +#endif /* Tree of chunks that are stand-alone huge allocations. */ static chunk_tree_t huge; @@ -756,7 +760,9 @@ static void *base_pages; static void *base_next_addr; static void *base_past_addr; /* Addr immediately past base_pages. */ static chunk_node_t *base_chunk_nodes; /* LIFO cache of chunk nodes. */ +#ifdef _REENTRANT static malloc_mutex_t base_mtx; +#endif #ifdef MALLOC_STATS static size_t base_mapped; #endif @@ -773,7 +779,9 @@ static size_t base_mapped; static arena_t **arenas; static unsigned narenas; static unsigned next_arena; +#ifdef _REENTRANT static malloc_mutex_t arenas_mtx; /* Protects arenas initialization. */ +#endif #ifndef NO_TLS /* @@ -784,7 +792,9 @@ static __thread arena_t *arenas_map; #define get_arenas_map() (arenas_map) #define set_arenas_map(x) (arenas_map = x) #else +#ifdef _REENTRANT static thread_key_t arenas_map_key; +#endif #define get_arenas_map() thr_getspecific(arenas_map_key) #define set_arenas_map(x) thr_setspecific(arenas_map_key, x) #endif diff --git a/lib/libc/stdlib/putenv.c b/lib/libc/stdlib/putenv.c index fa49920542a6..4a7f32319cb9 100644 --- a/lib/libc/stdlib/putenv.c +++ b/lib/libc/stdlib/putenv.c @@ -1,4 +1,4 @@ -/* $NetBSD: putenv.c,v 1.20 2013/04/25 07:08:56 matt Exp $ */ +/* $NetBSD: putenv.c,v 1.21 2015/01/20 18:31:25 christos Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)putenv.c 8.2 (Berkeley) 3/27/94"; #else -__RCSID("$NetBSD: putenv.c,v 1.20 2013/04/25 07:08:56 matt Exp $"); +__RCSID("$NetBSD: putenv.c,v 1.21 2015/01/20 18:31:25 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -46,7 +46,6 @@ __RCSID("$NetBSD: putenv.c,v 1.20 2013/04/25 07:08:56 matt Exp $"); #include #include "env.h" -#include "reentrant.h" #include "local.h" int diff --git a/lib/libc/stdlib/setenv.c b/lib/libc/stdlib/setenv.c index 0098b7b5c688..cf6c1b5a5ce5 100644 --- a/lib/libc/stdlib/setenv.c +++ b/lib/libc/stdlib/setenv.c @@ -1,4 +1,4 @@ -/* $NetBSD: setenv.c,v 1.43 2010/11/14 18:11:43 tron Exp $ */ +/* $NetBSD: setenv.c,v 1.44 2015/01/20 18:31:25 christos Exp $ */ /* * Copyright (c) 1987, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)setenv.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: setenv.c,v 1.43 2010/11/14 18:11:43 tron Exp $"); +__RCSID("$NetBSD: setenv.c,v 1.44 2015/01/20 18:31:25 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -46,7 +46,6 @@ __RCSID("$NetBSD: setenv.c,v 1.43 2010/11/14 18:11:43 tron Exp $"); #include #include "env.h" -#include "reentrant.h" #include "local.h" #ifdef __weak_alias diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c index a6cff2f0570b..0d5056a0b59c 100644 --- a/lib/libc/stdlib/system.c +++ b/lib/libc/stdlib/system.c @@ -1,4 +1,4 @@ -/* $NetBSD: system.c,v 1.24 2012/06/25 22:32:45 abs Exp $ */ +/* $NetBSD: system.c,v 1.25 2015/01/20 18:31:25 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: system.c,v 1.24 2012/06/25 22:32:45 abs Exp $"); +__RCSID("$NetBSD: system.c,v 1.25 2015/01/20 18:31:25 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -48,7 +48,6 @@ __RCSID("$NetBSD: system.c,v 1.24 2012/06/25 22:32:45 abs Exp $"); #include #include "env.h" -#include "reentrant.h" int system(const char *command) diff --git a/lib/libc/stdlib/unsetenv.c b/lib/libc/stdlib/unsetenv.c index 5796f3861c58..e1f79db83eeb 100644 --- a/lib/libc/stdlib/unsetenv.c +++ b/lib/libc/stdlib/unsetenv.c @@ -1,4 +1,4 @@ -/* $NetBSD: unsetenv.c,v 1.10 2010/11/14 18:11:43 tron Exp $ */ +/* $NetBSD: unsetenv.c,v 1.11 2015/01/20 18:31:25 christos Exp $ */ /* * Copyright (c) 1987, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)setenv.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: unsetenv.c,v 1.10 2010/11/14 18:11:43 tron Exp $"); +__RCSID("$NetBSD: unsetenv.c,v 1.11 2015/01/20 18:31:25 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -47,7 +47,6 @@ __RCSID("$NetBSD: unsetenv.c,v 1.10 2010/11/14 18:11:43 tron Exp $"); #include #include "env.h" -#include "reentrant.h" #include "local.h" /* diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index 157377364fff..a8789bd70844 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -1,4 +1,4 @@ -/* $NetBSD: strerror.c,v 1.16 2013/09/02 07:59:32 joerg Exp $ */ +/* $NetBSD: strerror.c,v 1.17 2015/01/20 18:31:25 christos Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: strerror.c,v 1.16 2013/09/02 07:59:32 joerg Exp $"); +__RCSID("$NetBSD: strerror.c,v 1.17 2015/01/20 18:31:25 christos Exp $"); #define __SETLOCALE_SOURCE__ @@ -71,8 +71,8 @@ strerror_setup(void) __aconst char * strerror_l(int num, locale_t loc) { -#ifdef _REENTRANT int error; +#ifdef _REENTRANT char *buf; thr_once(&strerror_once, strerror_setup);