summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbcook <bcook@cvs.openbsd.org>2014-07-19 15:29:26 +0000
committerbcook <bcook@cvs.openbsd.org>2014-07-19 15:29:26 +0000
commitb73f83f487802212fbffb298b3f7ca71fc8cbd2b (patch)
treebd55a5f67f3348970a12d34f12af2c3559fe98ba /lib
parentf1da3cf8c1d2c2fe840fab84ed76f18554e43d04 (diff)
Move _ARC4_ATFORK handlers from thread_private.h in portable.
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/crypto/arc4random_linux.h10
-rw-r--r--lib/libcrypto/crypto/arc4random_osx.h4
-rw-r--r--lib/libcrypto/crypto/arc4random_solaris.h4
3 files changed, 15 insertions, 3 deletions
diff --git a/lib/libcrypto/crypto/arc4random_linux.h b/lib/libcrypto/crypto/arc4random_linux.h
index 29dad3b9adf..0da5a4a433d 100644
--- a/lib/libcrypto/crypto/arc4random_linux.h
+++ b/lib/libcrypto/crypto/arc4random_linux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random_linux.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */
+/* $OpenBSD: arc4random_linux.h,v 1.6 2014/07/19 15:29:25 bcook Exp $ */
/*
* Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -28,6 +28,14 @@ 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)
+#ifdef __GLIBC__
+extern void *__dso_handle;
+extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
+#define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle)
+#else
+#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
+#endif
+
static volatile sig_atomic_t _rs_forked;
static inline void
diff --git a/lib/libcrypto/crypto/arc4random_osx.h b/lib/libcrypto/crypto/arc4random_osx.h
index 55932bb8238..aacbef9aaec 100644
--- a/lib/libcrypto/crypto/arc4random_osx.h
+++ b/lib/libcrypto/crypto/arc4random_osx.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random_osx.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */
+/* $OpenBSD: arc4random_osx.h,v 1.6 2014/07/19 15:29:25 bcook Exp $ */
/*
* Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -28,6 +28,8 @@ 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)
+#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
+
static volatile sig_atomic_t _rs_forked;
static inline void
diff --git a/lib/libcrypto/crypto/arc4random_solaris.h b/lib/libcrypto/crypto/arc4random_solaris.h
index e5ebbfb7e50..18b1bd54e05 100644
--- a/lib/libcrypto/crypto/arc4random_solaris.h
+++ b/lib/libcrypto/crypto/arc4random_solaris.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random_solaris.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */
+/* $OpenBSD: arc4random_solaris.h,v 1.6 2014/07/19 15:29:25 bcook Exp $ */
/*
* Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -28,6 +28,8 @@ 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)
+#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
+
static volatile sig_atomic_t _rs_forked;
static inline void