diff options
-rw-r--r-- | lib/libc/asr/res_init.c | 8 | ||||
-rw-r--r-- | lib/libc/net/res_random.c | 8 | ||||
-rw-r--r-- | lib/libc/stdio/findfp.c | 18 | ||||
-rw-r--r-- | lib/libc/stdlib/random.c | 8 |
4 files changed, 21 insertions, 21 deletions
diff --git a/lib/libc/asr/res_init.c b/lib/libc/asr/res_init.c index 01a3023bf87..c0a6af3aaec 100644 --- a/lib/libc/asr/res_init.c +++ b/lib/libc/asr/res_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_init.c,v 1.9 2016/03/23 18:45:03 chrisz Exp $ */ +/* $OpenBSD: res_init.c,v 1.10 2016/04/05 04:29:21 guenther Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -37,7 +37,7 @@ int h_errno; int res_init(void) { - _THREAD_PRIVATE_MUTEX(init); + static void *resinit_mutex; struct asr_ctx *ac; int i; @@ -48,7 +48,7 @@ res_init(void) * structure from the async context, not overriding fields set early * by the user. */ - _THREAD_PRIVATE_MUTEX_LOCK(init); + _MUTEX_LOCK(&resinit_mutex); if (!(_res.options & RES_INIT)) { if (_res.retry == 0) _res.retry = ac->ac_nsretries; @@ -75,7 +75,7 @@ res_init(void) _res.nscount = i; _res.options |= RES_INIT; } - _THREAD_PRIVATE_MUTEX_UNLOCK(init); + _MUTEX_UNLOCK(&resinit_mutex); /* * If the program is not threaded, we want to reflect (some) changes diff --git a/lib/libc/net/res_random.c b/lib/libc/net/res_random.c index 72b9c41a2a9..763e420bb88 100644 --- a/lib/libc/net/res_random.c +++ b/lib/libc/net/res_random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_random.c,v 1.23 2015/10/05 02:57:16 guenther Exp $ */ +/* $OpenBSD: res_random.c,v 1.24 2016/04/05 04:29:21 guenther Exp $ */ /* * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> @@ -230,12 +230,12 @@ __res_randomid(void) struct timespec ts; pid_t pid; u_int r; - _THREAD_PRIVATE_MUTEX(random); + static void *randomid_mutex; clock_gettime(CLOCK_MONOTONIC, &ts); pid = getpid(); - _THREAD_PRIVATE_MUTEX_LOCK(random); + _MUTEX_LOCK(&randomid_mutex); if (ru_counter >= RU_MAX || ts.tv_sec > ru_reseed || pid != ru_pid) { res_initid(); @@ -248,7 +248,7 @@ __res_randomid(void) r = permute15(ru_seed ^ pmod(ru_g, ru_seed2 + ru_x, RU_N)) | ru_msb; - _THREAD_PRIVATE_MUTEX_UNLOCK(random); + _MUTEX_UNLOCK(&randomid_mutex); return (r); } diff --git a/lib/libc/stdio/findfp.c b/lib/libc/stdio/findfp.c index 0cdd1faf3a0..d30e45aec41 100644 --- a/lib/libc/stdio/findfp.c +++ b/lib/libc/stdio/findfp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: findfp.c,v 1.18 2015/08/27 04:37:09 guenther Exp $ */ +/* $OpenBSD: findfp.c,v 1.19 2016/04/05 04:29:21 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -56,7 +56,7 @@ static FILE usual[FOPEN_MAX - 3]; static struct __sfileext usualext[FOPEN_MAX - 3]; static struct glue uglue = { 0, FOPEN_MAX - 3, usual }; static struct glue *lastglue = &uglue; -_THREAD_PRIVATE_MUTEX(__sfp_mutex); +static void *sfp_mutex; static struct __sfileext __sFext[3]; FILE __sF[3] = { @@ -108,7 +108,7 @@ __sfp(void) if (!__sdidinit) __sinit(); - _THREAD_PRIVATE_MUTEX_LOCK(__sfp_mutex); + _MUTEX_LOCK(&sfp_mutex); for (g = &__sglue; g != NULL; g = g->next) { for (fp = g->iobs, n = g->niobs; --n >= 0; fp++) if (fp->_flags == 0) @@ -116,16 +116,16 @@ __sfp(void) } /* release lock while mallocing */ - _THREAD_PRIVATE_MUTEX_UNLOCK(__sfp_mutex); + _MUTEX_UNLOCK(&sfp_mutex); if ((g = moreglue(NDYNAMIC)) == NULL) return (NULL); - _THREAD_PRIVATE_MUTEX_LOCK(__sfp_mutex); + _MUTEX_LOCK(&sfp_mutex); lastglue->next = g; lastglue = g; fp = g->iobs; found: fp->_flags = 1; /* reserve this slot; caller sets real flags */ - _THREAD_PRIVATE_MUTEX_UNLOCK(__sfp_mutex); + _MUTEX_UNLOCK(&sfp_mutex); fp->_p = NULL; /* no current pointer */ fp->_w = 0; /* nothing to read or write */ fp->_r = 0; @@ -161,10 +161,10 @@ _cleanup(void) void __sinit(void) { - _THREAD_PRIVATE_MUTEX(__sinit_mutex); + static void *sinit_mutex; int i; - _THREAD_PRIVATE_MUTEX_LOCK(__sinit_mutex); + _MUTEX_LOCK(&sinit_mutex); if (__sdidinit) goto out; /* bail out if caller lost the race */ for (i = 0; i < FOPEN_MAX - 3; i++) { @@ -174,5 +174,5 @@ __sinit(void) __atexit_register_cleanup(_cleanup); /* conservative */ __sdidinit = 1; out: - _THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex); + _MUTEX_UNLOCK(&sinit_mutex); } diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c index e293648ecd3..41d5f64b583 100644 --- a/lib/libc/stdlib/random.c +++ b/lib/libc/stdlib/random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: random.c,v 1.29 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: random.c,v 1.30 2016/04/05 04:29:21 guenther Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. * All rights reserved. @@ -175,11 +175,11 @@ static int rand_sep = SEP_3; static int random_deterministic; -_THREAD_PRIVATE_MUTEX(random); +static void *random_mutex; static long random_l(void); -#define LOCK() _THREAD_PRIVATE_MUTEX_LOCK(random) -#define UNLOCK() _THREAD_PRIVATE_MUTEX_UNLOCK(random) +#define LOCK() _MUTEX_LOCK(&random_mutex) +#define UNLOCK() _MUTEX_UNLOCK(&random_mutex) /* * srandom: |