HADOOP-11638. OpensslSecureRandom.c pthreads_thread_id should support FreeBSD and Solaris in addition to Linux (Kiran Kumar M R via Colin P. McCabe)

This commit is contained in:
Colin Patrick Mccabe 2015-03-09 12:56:33 -07:00
parent de1101cb5b
commit 3241fc2b17
2 changed files with 19 additions and 1 deletions

View File

@ -671,6 +671,10 @@ Release 2.7.0 - UNRELEASED
HADOOP-11642. Upgrade azure sdk version from 0.6.0 to 2.0.0. HADOOP-11642. Upgrade azure sdk version from 0.6.0 to 2.0.0.
(Shashank Khandelwal and Ivan Mitic via cnauroth) (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 OPTIMIZATIONS
HADOOP-11323. WritableComparator#compare keeps reference to byte array. HADOOP-11323. WritableComparator#compare keeps reference to byte array.

View File

@ -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,17 @@ 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();
#else
#error "Platform not supported"
#endif
return thread_id;
} }
#endif /* UNIX */ #endif /* UNIX */