From 1661ac3cfabdbdc39c18adb18e55ac6b85e3d05d Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Tue, 26 May 2015 11:08:23 -0400 Subject: socket: fix multithreading-related build problems on RHEL5 Change-Id: I3e145137c3ef738c4459c8d3098d6094ccfb008a BUG: 1225072 Signed-off-by: Jeff Darcy Reviewed-on: http://review.gluster.org/10921 Reviewed-by: Kaleb KEITHLEY Reviewed-by: Niels de Vos Tested-by: Gluster Build System Reviewed-by: Raghavendra Bhat --- rpc/rpc-transport/socket/src/socket.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 564f35cdae5..ae5ed849c9a 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -3635,6 +3635,7 @@ locking_func (int mode, int type, const char *file, int line) } } +#if HAVE_CRYPTO_THREADID static void threadid_func (CRYPTO_THREADID *id) { @@ -3650,6 +3651,14 @@ threadid_func (CRYPTO_THREADID *id) */ CRYPTO_THREADID_set_numeric (id, (unsigned long)pthread_self()); } +#else /* older openssl */ +static unsigned long +legacy_threadid_func (void) +{ + /* See comments above, it applies here too. */ + return (unsigned long)pthread_self(); +} +#endif static void __attribute__((constructor)) init_openssl_mt (void) @@ -3664,7 +3673,11 @@ init_openssl_mt (void) pthread_mutex_init (&lock_array[i], NULL); } CRYPTO_set_locking_callback (locking_func); +#if HAVE_CRYPTO_THREADID CRYPTO_THREADID_set_callback (threadid_func); +#else /* older openssl */ + CRYPTO_set_id_callback (legacy_threadid_func); +#endif constructor_ok = _gf_true; } -- cgit