[ 
https://issues.apache.org/jira/browse/HADOOP-11638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14351240#comment-14351240
 ] 

Dan McGregor commented on HADOOP-11638:
---------------------------------------

Sorry, I could have been more clear. pthread_getthreadid_np() on FreeBSD casts 
the real thread ID into an int and returns it. The thread ID is stored as the 
first member of the pthread_t structure.

FreeBSD's pthread_getthreadid_np function does this:

struct pthread *curthread;
curthread = _get_curthread();
return (TID(curthread));

Where TID() is this:

#define TID(thread) ((uint32_t) ((thread)->tid))

And the member tid of struct pthread is an unsigned long. That said, the TID 
macro is used all over FreeBSD's pthread implementation, so it's safe to say it 
will never be bigger than a uint32_t.



> Linux-specific gettid() used in OpensslSecureRandom.c
> -----------------------------------------------------
>
>                 Key: HADOOP-11638
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11638
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: native
>    Affects Versions: 2.6.0
>            Reporter: Dmitry Sivachenko
>            Assignee: Kiran Kumar M R
>              Labels: freebsd
>         Attachments: HADOOP-11638-001.patch, HADOOP-11638-002.patch, 
> HADOOP-11638-003.patch
>
>
> In OpensslSecureRandom.c you use Linux-specific syscall gettid():
> static unsigned long pthreads_thread_id(void)
> {
> return (unsigned long)syscall(SYS_gettid);
> }
> Man page says:
> gettid()  is Linux-specific and should not be used in programs that are
> intended to be portable.
> This breaks hadoop-2.6.0 compilation on FreeBSD (may be on other OSes too).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to