Subject: Re: _POSIX_C_SOURCE 199309L and when to use _NETBSD_SOURCE?
To: None <>
From: Ben Harris <>
List: current-users
Date: 12/18/2006 14:18:29
In article <> you write:
>I didn't get any feedback.
>I have done more research.
>Are our headers broken? This is NetBSD/i386 3.99.24.
>> > /usr/include/unistd.h:321: error: expected declaration specifiers or '...' before 'u_int'
>> > In file included from ../include/misc.h:143,
>> >                  from utils.c:83:
>> > /usr/include/stdlib.h:246: error: expected ')' before '*' token
>u_char is unknown. It is defined in /usr/include/sys/types.h:

I don't understand this.  Both of those lines are inside
"#ifdef _NETBSD_SOURCE" blocks, so they shouldn't be visible unless 
_NETBSD_SOURCE is defined, but if it were defined, <sys/types.h> would 
have defined the requisite types.  This suggests to me that something, 
maybe a badly broken system header or maybe your application, is 
defining _NETBSD_SOURCE in between <sys/types.h> and <unistd.h>.

>> > In file included from utils.c:102:
>> > /usr/include/signal.h:69: error: expected ')' before 'int'
>pthread_t is unknown. It is defined in /usr/include/pthread_types.h which 
>is is included by /usr/include/pthread.h and /usr/include/sys/types.h.
>The sys/types.h only pulls it in like:
>#if !defined(_KERNEL) && !defined(_STANDALONE)
>#if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
>    defined(_NETBSD_SOURCE)
>#include <pthread_types.h>

Again, those are precisely the conditions around the declaration of 
pthread_kill(), so something's mangling your preprocessor macros 
between <sys/types.h> and <signal.h>.

You might find it useful to use the -H option of GCC to find out 
precisely which header files are being used and then search them for 
mistaken definitions.

Ben Harris