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 cn...@apache.org on 2015/03/16 22:09:17 UTC
[2/3] hadoop git commit: HADOOP-11638. OpensslSecureRandom.c
pthreads_thread_id should support FreeBSD and Solaris in addition to Linux.
Contributed by Kiran Kumar M R.
HADOOP-11638. OpensslSecureRandom.c pthreads_thread_id should support FreeBSD and Solaris in addition to Linux. Contributed by Kiran Kumar M R.
(cherry picked from commit 72cd4e4a4eb2a9f8695d4c67eb55dd2be36c52dc)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/f492fc7b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/f492fc7b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/f492fc7b
Branch: refs/heads/branch-2
Commit: f492fc7b2cfe282edd41d1879312aaf170fbe774
Parents: 0e9f78d
Author: cnauroth <cn...@apache.org>
Authored: Mon Mar 16 13:26:57 2015 -0700
Committer: cnauroth <cn...@apache.org>
Committed: Mon Mar 16 14:05:05 2015 -0700
----------------------------------------------------------------------
hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++
.../hadoop/crypto/random/OpensslSecureRandom.c | 18 +++++++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/f492fc7b/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 f734202..788d894 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -691,6 +691,9 @@ Release 2.7.0 - UNRELEASED
HADOOP-11558. Fix dead links to doc of hadoop-tools. (Jean-Pierre
Matsumoto via ozawa)
+ HADOOP-11638. OpensslSecureRandom.c pthreads_thread_id should support FreeBSD
+ and Solaris in addition to Linux. (Kiran Kumar M R via cnauroth)
+
Release 2.6.1 - UNRELEASED
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/f492fc7b/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..8f0c06d 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,19 @@ 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();
+#elif defined(__APPLE__)
+ (void)pthread_threadid_np(pthread_self(), &thread_id);
+#else
+#error "Platform not supported"
+#endif
+ return thread_id;
}
#endif /* UNIX */