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 72cd4e4a4e
)
This commit is contained in:
parent
ad4d704fbb
commit
389b28033a
|
@ -662,6 +662,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
HADOOP-11558. Fix dead links to doc of hadoop-tools. (Jean-Pierre
|
HADOOP-11558. Fix dead links to doc of hadoop-tools. (Jean-Pierre
|
||||||
Matsumoto via ozawa)
|
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
|
Release 2.6.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include <pthread_np.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#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)
|
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 */
|
#endif /* UNIX */
|
||||||
|
|
Loading…
Reference in New Issue