diff options
author | Rich Salz <rsalz@openssl.org> | 2017-06-22 14:00:06 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-06-29 16:19:41 -0400 |
commit | 2915fe19a6676374c335d8c50eaaa4c940cf47d6 (patch) | |
tree | 4d959df974cc5ea075a230101ac2b95c7da23320 /crypto/threads_pthread.c | |
parent | 5ee407460b3b68aa4695f17cf8c43e0d07cb18a8 (diff) | |
download | openssl-new-2915fe19a6676374c335d8c50eaaa4c940cf47d6.tar.gz |
Add fork handlers, based on pthread_atfork
Only for Unix platforms
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3754)
Diffstat (limited to 'crypto/threads_pthread.c')
-rw-r--r-- | crypto/threads_pthread.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c index 151013e470..f7c792123b 100644 --- a/crypto/threads_pthread.c +++ b/crypto/threads_pthread.c @@ -8,6 +8,7 @@ */ #include <openssl/crypto.h> +#include <internal/cryptlib.h> #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS) @@ -168,4 +169,13 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) return 1; } +int openssl_init_fork_handlers(void) +{ +# ifdef OPENSSL_SYS_UNIX + if (pthread_atfork(OPENSSL_fork_prepare, + OPENSSL_fork_parent, OPENSSL_fork_child) == 0) + return 1; +# endif + return 0; +} #endif |