Broken _XOPEN_SOURCE feature test macro.

Kaz Kylheku kaz at
Wed Apr 11 04:52:10 UTC 2012

Hi all,

I'm using FreeBSD 9.0 (the VirtualBox image for Port Maintainers to port some code.

It looks like support for the _XOPEN_SOURCE feature test macro
is broken if this macro is simply defined, or defined with
any value less than 500.

If you compile your source with -D_XOPEN_SOURCE or, say,
-D_XOPEN_SOURCE=2, it looks like you get *everything*.
The <sys/cdefs.h> header treats this case as if you had not
specified any feature test macro at all.

(I'm using _XOPEN_SOURCE=2 because on NetBSD 5.1, specifying
merely _XOPEN_SOURCE leaves the popen an pclose declarations
hidden in <stdio.h>. I could go to 500, but there isn't
anything I need that I don't already have with 2.
I don't have a copy of these old X/Open documents, and
have not been able to Google up anything about this value
2, but I'm guessing that maybe there was a version 2
which added popen and pclose.)

More information about the freebsd-bugs mailing list