sys/types.h is broken for _POSIX_THREADS

Joel Sherrill joel.sherrill@oarcorp.com
Wed Feb 24 01:49:00 GMT 2010


On 02/23/2010 06:19 PM, Renato Caldas wrote:
> On Tue, Feb 23, 2010 at 11:35 PM, Jeff Johnston<jjohnstn@redhat.com>  wrote:
>    
>> On 23/02/10 05:41 PM, Renato Caldas wrote:
>>      
>>> Hello,
>>>
>>> I've been trying to compile rtems for a few days, it always failed
>>> with a strange error message. Now I belive I found out why: I had
>>> compiled gcc with --enable-threads.
>>>
>>> I managed to find one problem. In sys/types.h there is:
>>>
>>> #if defined(_POSIX_THREADS)&&    !defined(__CYGWIN__)
>>> (...)
>>>
>>> #if defined(__XMK__)
>>> typedef struct pthread_attr_s {
>>> (...)
>>> } pthread_attr_t;
>>>
>>> (...)
>>>
>>> #else /* !defined(__XMK__) */
>>> typedef struct {
>>> (...)
>>> #endif /* !defined(__XMK__) */
>>>
>>> (...)
>>> } pthread_attr_t;
>>>
>>> (...)
>>>
>>> #endif /* defined(_POSIX_THREADS) */
>>>
>>> This is clearly broken, because a spurious "} pthread_attr_t" is
>>> placed in the code #if defined(__XMK__). The fix seems to be easy.
>>>
>>>        
>> Thanks for catching this.
>>
>> It appears some __XMK__ patches weren't applied right as there was also some
>> redundant checking for __XMK__ being performed.  I have posted a patch.
>>      
> Thanks! Disabling thread support in gcc doesn't fix it though, so it
> must be something else...
>
>    
>>> I assume thread support is severely broken, or at least severely
>>> untested, right? If so, wouldn't it be wiser to just make sure it is
>>> disabled?
>>>
>>>        
>> You'll have to take that up on the RTEMS lists as the thread support code
>> isn't actually in newlib and RTEMS is tested by the RTEMS folks. Cygwin also
>> uses thread support and I would assume it is working fine as they are pretty
>> quick to report issues.
>>      
> It seems the cygwin code takes a different route:
> #if defined(_POSIX_THREADS)&&   !defined(__CYGWIN__)
>
> My feeling is that few people actually build RTEMS in non-windows
> hosts :) I'll bug the RTEMS folks tomorrow, thanks.
>
>    
You would be wrong.  Most people build RTEMS on
non-Windows hosts. :)  I would say now we are evenly
split between Fedora, Centos, and Ubuntu with a
fair number of MacOS users. :)

Are you using our prebuilt RPMs?  How are you building
the tools.

--joel
> Cheers,
>    Renato
>
>    
>> -- Jeff J.
>>
>>      
>>> Cheers,
>>>    Renato
>>>        
>>
>>      


-- 
Joel Sherrill, Ph.D.             Director of Research&  Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985




More information about the Newlib mailing list