NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD and _POSIX_C_SOURCE



On Sat, 4 May 2019 09:47:30 +0100
Sad Clouds <cryintothebluesky%gmail.com@localhost> wrote:

> If I define _POSIX_C_SOURCE=200809L then certain types are no longer
> visible: 
> 
> rp3$ cat /tmp/test.c
> #include <sched.h>
> 
> int main(void)
> {
>         cpuset_t cset;
> }
> 
> rp3$ gcc -D_POSIX_C_SOURCE=200809L -Wall -pedantic /tmp/test.c
> /tmp/test.c: In function 'main':
> /tmp/test.c:5:2: error: unknown type name 'cpuset_t'; did you mean
> 'sigset_t'? cpuset_t *cset;
>   ^~~~~~~~
>   sigset_t
> /tmp/test.c:5:12: warning: unused variable 'cset' [-Wunused-variable]
>   cpuset_t *cset;
>             ^~~~
> 
> So what are the recommended macros to get all POSIX APIs + all NetBSD
> specific extensions?

So reading
https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/featuretest.h

it says

"If more than one of these "major" feature-test macros is defined, then
the set of facilities provided (and namespace used) is the union of
that specified by the relevant standards"

"If none of the "major" feature-test macros is defined, _NETBSD_SOURCE
is assumed"

So if I'm not mistaken, then defining only _POSIX_C_SOURCE=200809L
explicitly hides _NETBSD_SOURCE, hence if I want POSIX + all NetBSD
extensions then it looks like I need to define both?



Home | Main Index | Thread Index | Old Index