Subject: Re: _POSIX_C_SOURCE 199309L and when to use _NETBSD_SOURCE?
To: None <>
From: Jeremy C. Reed <>
List: current-users
Date: 12/15/2006 13:17:01
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:

#if defined(_NETBSD_SOURCE)
typedef unsigned char   u_char;
typedef unsigned short  u_short;

This _NETBSD_SOURCE is defined in /usr/include/sys/featuretest.h which 
basically pulled in by every NetBSD include header.

#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
    !defined(_XOPEN_SOURCE) && !defined(_NETBSD_SOURCE)
#define _NETBSD_SOURCE 1

So because _POSIX_C_SOURCE is defined by default I have _NETBSD_SOURCE not 
defined and so u_char is not defined.

Note that u_char is not used directly by the code I am trying to build.

> > 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 || \
#include <pthread_types.h>

In this case, 199506L is too new.

Why is pthread_t being used?

Are our headers broken?

> > In file included from utils.c:107:
> > /usr/include/sys/wait.h:135: error: duplicate member 'w_Filler'
> > [lots of these elided]
> > /usr/include/sys/wait.h:155: error: duplicate member '({anonymous})'