summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2015-05-26 11:08:23 -0400
committerRaghavendra Bhat <raghavendra@redhat.com>2015-05-27 04:39:34 -0700
commit1661ac3cfabdbdc39c18adb18e55ac6b85e3d05d (patch)
treea0e39baeeacb1ad26c89625e1c69b506c017b5af
parent1ae9ce7e3d8d59dcb491f2f3a01e7b532e1de2b3 (diff)
socket: fix multithreading-related build problems on RHEL5
Change-Id: I3e145137c3ef738c4459c8d3098d6094ccfb008a BUG: 1225072 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/10921 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
-rw-r--r--rpc/rpc-transport/socket/src/socket.c13
1 files changed, 13 insertions, 0 deletions
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;
}