You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cm...@apache.org on 2015/03/09 20:56:51 UTC
hadoop git commit: HADOOP-11638. OpensslSecureRandom.c
pthreads_thread_id should support FreeBSD and Solaris in addition to Linux
(Kiran Kumar M R via Colin P. McCabe)
Repository: hadoop
Updated Branches:
refs/heads/trunk de1101cb5 -> 3241fc2b1
HADOOP-11638. OpensslSecureRandom.c pthreads_thread_id should support FreeBSD and Solaris in addition to Linux (Kiran Kumar M R via Colin P. McCabe)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3241fc2b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3241fc2b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3241fc2b
Branch: refs/heads/trunk
Commit: 3241fc2b17f11e621d8ffb6160caa4b850c278b6
Parents: de1101c
Author: Colin Patrick Mccabe <cm...@cloudera.com>
Authored: Mon Mar 9 12:56:33 2015 -0700
Committer: Colin Patrick Mccabe <cm...@cloudera.com>
Committed: Mon Mar 9 12:56:33 2015 -0700
----------------------------------------------------------------------
hadoop-common-project/hadoop-common/CHANGES.txt | 4 ++++
.../hadoop/crypto/random/OpensslSecureRandom.c | 16 +++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3241fc2b/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index d5a8463..0fe5b7c 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -671,6 +671,10 @@ Release 2.7.0 - UNRELEASED
HADOOP-11642. Upgrade azure sdk version from 0.6.0 to 2.0.0.
(Shashank Khandelwal and Ivan Mitic via cnauroth)
+ HADOOP-11638. OpensslSecureRandom.c pthreads_thread_id should support
+ FreeBSD and Solaris in addition to Linux (Kiran Kumar M R via Colin P.
+ McCabe)
+
OPTIMIZATIONS
HADOOP-11323. WritableComparator#compare keeps reference to byte array.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/3241fc2b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/random/OpensslSecureRandom.c
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/random/OpensslSecureRandom.c b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/random/OpensslSecureRandom.c
index 6c31d10..f30ccbe 100644
--- a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/random/OpensslSecureRandom.c
+++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/crypto/random/OpensslSecureRandom.c
@@ -29,6 +29,10 @@
#include <sys/types.h>
#endif
+#if defined(__FreeBSD__)
+#include <pthread_np.h>
+#endif
+
#ifdef WINDOWS
#include <windows.h>
#endif
@@ -274,7 +278,17 @@ static void pthreads_locking_callback(int mode, int type, char *file, int line)
static unsigned long pthreads_thread_id(void)
{
- return (unsigned long)syscall(SYS_gettid);
+ unsigned long thread_id = 0;
+#if defined(__linux__)
+ thread_id = (unsigned long)syscall(SYS_gettid);
+#elif defined(__FreeBSD__)
+ thread_id = (unsigned long)pthread_getthreadid_np();
+#elif defined(__sun)
+ thread_id = (unsigned long)pthread_self();
+#else
+#error "Platform not supported"
+#endif
+ return thread_id;
}
#endif /* UNIX */