diff options
author | Brent Cook <bcook@cvs.openbsd.org> | 2014-07-19 14:34:39 +0000 |
---|---|---|
committer | Brent Cook <bcook@cvs.openbsd.org> | 2014-07-19 14:34:39 +0000 |
commit | ddf2b3d96a21886d91850648af9a63b718c8425f (patch) | |
tree | 1902c57a44191a1af8a52f2c8cea4d63bcd7e6f4 | |
parent | b3af59632c7162968fbd98408e4a9a69a53d5e5a (diff) |
move _ARC4_LOCK/UNLOCK primitives from thread_private into OS-specific modules
-rw-r--r-- | lib/libcrypto/arc4random/arc4random_linux.h | 8 | ||||
-rw-r--r-- | lib/libcrypto/arc4random/arc4random_osx.h | 8 | ||||
-rw-r--r-- | lib/libcrypto/arc4random/arc4random_solaris.h | 9 |
3 files changed, 22 insertions, 3 deletions
diff --git a/lib/libcrypto/arc4random/arc4random_linux.h b/lib/libcrypto/arc4random/arc4random_linux.h index 992ee6bb8ef..29dad3b9adf 100644 --- a/lib/libcrypto/arc4random/arc4random_linux.h +++ b/lib/libcrypto/arc4random/arc4random_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_linux.h,v 1.4 2014/07/19 13:02:28 bcook Exp $ */ +/* $OpenBSD: arc4random_linux.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres <dm@uun.org> @@ -22,6 +22,12 @@ * Stub functions for portability. */ +#include <pthread.h> + +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + static volatile sig_atomic_t _rs_forked; static inline void diff --git a/lib/libcrypto/arc4random/arc4random_osx.h b/lib/libcrypto/arc4random/arc4random_osx.h index 274288000f4..55932bb8238 100644 --- a/lib/libcrypto/arc4random/arc4random_osx.h +++ b/lib/libcrypto/arc4random/arc4random_osx.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_osx.h,v 1.4 2014/07/19 13:02:28 bcook Exp $ */ +/* $OpenBSD: arc4random_osx.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres <dm@uun.org> @@ -22,6 +22,12 @@ * Stub functions for portability. */ +#include <pthread.h> + +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + static volatile sig_atomic_t _rs_forked; static inline void diff --git a/lib/libcrypto/arc4random/arc4random_solaris.h b/lib/libcrypto/arc4random/arc4random_solaris.h index 128f61e0033..e5ebbfb7e50 100644 --- a/lib/libcrypto/arc4random/arc4random_solaris.h +++ b/lib/libcrypto/arc4random/arc4random_solaris.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_solaris.h,v 1.4 2014/07/19 13:02:28 bcook Exp $ */ +/* $OpenBSD: arc4random_solaris.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres <dm@uun.org> @@ -21,6 +21,13 @@ /* * Stub functions for portability. */ + +#include <pthread.h> + +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + static volatile sig_atomic_t _rs_forked; static inline void |