Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc Fix non _REENTRANT build.
details: https://anonhg.NetBSD.org/src/rev/a3199ee36942
branches: trunk
changeset: 335676:a3199ee36942
user: christos <christos%NetBSD.org@localhost>
date: Tue Jan 20 18:31:24 2015 +0000
description:
Fix non _REENTRANT build.
diffstat:
lib/libc/compat/stdlib/compat_putenv.c | 5 +-
lib/libc/compat/stdlib/compat_random.c | 5 +-
lib/libc/compat/stdlib/compat_unsetenv.c | 5 +-
lib/libc/gdtoa/gdtoa_locks.c | 4 +-
lib/libc/gen/arc4random.c | 19 +++------
lib/libc/gen/popen.c | 5 +-
lib/libc/gen/pthread_atfork.c | 6 ++-
lib/libc/include/env.h | 4 +-
lib/libc/include/reentrant.h | 63 +++++++++++++++++--------------
lib/libc/rpc/clnt_simple.c | 21 +++++-----
lib/libc/rpc/clnt_vc.c | 6 +-
lib/libc/stdlib/_env.c | 5 +-
lib/libc/stdlib/atexit.c | 6 ++-
lib/libc/stdlib/getenv.c | 5 +-
lib/libc/stdlib/jemalloc.c | 14 ++++++-
lib/libc/stdlib/putenv.c | 5 +-
lib/libc/stdlib/setenv.c | 5 +-
lib/libc/stdlib/system.c | 5 +-
lib/libc/stdlib/unsetenv.c | 5 +-
lib/libc/string/strerror.c | 6 +-
20 files changed, 103 insertions(+), 96 deletions(-)
diffs (truncated from 693 to 300 lines):
diff -r 08170182d9fc -r a3199ee36942 lib/libc/compat/stdlib/compat_putenv.c
--- a/lib/libc/compat/stdlib/compat_putenv.c Tue Jan 20 17:29:58 2015 +0000
+++ b/lib/libc/compat/stdlib/compat_putenv.c Tue Jan 20 18:31:24 2015 +0000
@@ -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 <sys/cdefs.h>
#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 @@
#include <compat/include/stdlib.h>
#include "env.h"
-#include "reentrant.h"
#include "local.h"
#ifdef __weak_alias
diff -r 08170182d9fc -r a3199ee36942 lib/libc/compat/stdlib/compat_random.c
--- a/lib/libc/compat/stdlib/compat_random.c Tue Jan 20 17:29:58 2015 +0000
+++ b/lib/libc/compat/stdlib/compat_random.c Tue Jan 20 18:31:24 2015 +0000
@@ -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 <sys/cdefs.h>
#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 @@
#include <compat/include/stdlib.h>
#include "env.h"
-#include "reentrant.h"
#include "local.h"
#ifdef __weak_alias
diff -r 08170182d9fc -r a3199ee36942 lib/libc/compat/stdlib/compat_unsetenv.c
--- a/lib/libc/compat/stdlib/compat_unsetenv.c Tue Jan 20 17:29:58 2015 +0000
+++ b/lib/libc/compat/stdlib/compat_unsetenv.c Tue Jan 20 18:31:24 2015 +0000
@@ -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 @@
#include <compat/include/stdlib.h>
#include <string.h>
#include <bitstring.h>
-#include "reentrant.h"
#include "local.h"
#ifdef __weak_alias
diff -r 08170182d9fc -r a3199ee36942 lib/libc/gdtoa/gdtoa_locks.c
--- a/lib/libc/gdtoa/gdtoa_locks.c Tue Jan 20 17:29:58 2015 +0000
+++ b/lib/libc/gdtoa/gdtoa_locks.c Tue Jan 20 18:31:24 2015 +0000
@@ -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 <kleink%NetBSD.org@localhost>, November 16, 2005.
@@ -7,4 +7,6 @@
#include "gdtoaimp.h"
+#ifdef _REENTRANT
mutex_t __gdtoa_locks[2] = { MUTEX_INITIALIZER, MUTEX_INITIALIZER };
+#endif
diff -r 08170182d9fc -r a3199ee36942 lib/libc/gen/arc4random.c
--- a/lib/libc/gen/arc4random.c Tue Jan 20 17:29:58 2015 +0000
+++ b/lib/libc/gen/arc4random.c Tue Jan 20 18:31:24 2015 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
(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 @@
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 @@
* 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 @@
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 @@
/* 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 -r 08170182d9fc -r a3199ee36942 lib/libc/gen/popen.c
--- a/lib/libc/gen/popen.c Tue Jan 20 17:29:58 2015 +0000
+++ b/lib/libc/gen/popen.c Tue Jan 20 18:31:24 2015 +0000
@@ -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 @@
#include <fcntl.h>
#include "env.h"
-#include "reentrant.h"
#ifdef __weak_alias
__weak_alias(popen,_popen)
diff -r 08170182d9fc -r a3199ee36942 lib/libc/gen/pthread_atfork.c
--- a/lib/libc/gen/pthread_atfork.c Tue Jan 20 17:29:58 2015 +0000
+++ b/lib/libc/gen/pthread_atfork.c Tue Jan 20 18:31:24 2015 +0000
@@ -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 <sys/cdefs.h>
#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 @@
* 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 -r 08170182d9fc -r a3199ee36942 lib/libc/include/env.h
--- a/lib/libc/include/env.h Tue Jan 20 17:29:58 2015 +0000
+++ b/lib/libc/include/env.h Tue Jan 20 18:31:24 2015 +0000
@@ -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 @@
}
static __inline bool
-__unlocklockenv(void)
+__unlockenv(void)
{
return true;
}
diff -r 08170182d9fc -r a3199ee36942 lib/libc/include/reentrant.h
--- a/lib/libc/include/reentrant.h Tue Jan 20 17:29:58 2015 +0000
+++ b/lib/libc/include/reentrant.h Tue Jan 20 18:31:24 2015 +0000
@@ -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 @@
#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
Home |
Main Index |
Thread Index |
Old Index