Subject: Re: standards: pthreads vs _XOPEN_SOURCE
To: None <>
From: Ben Harris <>
List: current-users
Date: 07/02/2003 18:51:31
In article <> you write:
>is it correct that pthreads cannot be used if _XOPEN_SOURCE
>is defined? (just try on -current...)

It shouldn't be, at least if you define _XOPEN_SOURCE to be at least 600.

>I'm lacking some understanding whether these _XXX_SOURCE
>defines are thought to provide functionality or to clean the
>namespace by disabling everything else.

You can look at it either way around.  For the most part, feature-test
macros are additive, so if you define _FOO_SOURCE and _BAR_SOURCE, you get
the union of the things they specify separately.  There are two important
exceptions, though:

1: If you don't specify any feature-test macros at all, _NETBSD_SOURCE
(which enables everything) gets defined.

2: If two feature-test macros conflict somehow, the behaviour of the
"smaller" one wins.  Thus, defining _POSIX_C_SOURCE at the same time as
_NETBSD_SOURCE is equivalent to defining _NETBSD_SOURCE on its own except
that the POSIX definitions of rename() and chown() are used instead if the
NetBSD ones.

This really ought to be written up at the top of <sys/featuretest.h>, and
maybe in intro(3) as well.

Ben Harris                                                   <>
Portmaster, NetBSD/acorn26           <URL:>