This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bsd_signal's prototype unavailable when _GNU_SOURCE is defined


Man page of bsd_signal says:
>        bsd_signal():
>           Since glibc 2.26:
>               _XOPEN_SOURCE >= 500
>                   && ! (_POSIX_C_SOURCE >= 200112L)
>          Glibc 2.25 and earlier:
>              _XOPEN_SOURCE

Defining those two macros as such works. But when I define _GNU_SOURCE
additionally, it doesn't work. The following demonstrates the problem:

```
$ cat x.c
#include <signal.h>
int main(void)
{
    bsd_signal(0, 0);
}
$ gcc -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506L -std=gnu99 x.c
$ gcc -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506L -std=gnu99
-D_GNU_SOURCE x.c
x.c: In function ‘main’:
x.c:4:5: warning: implicit declaration of function ‘bsd_signal’; did you
mean ‘ssignal’? [-Wimplicit-function-declaration]
     bsd_signal(0, 0);
     ^~~~~~~~~~
     ssignal

As seen above, defining _GNU_SOURCE makes bsd_signal unavailable, it works
when _XOPEN_SOURCE and _POSIX_C_SOURCE are defined as man page says.
But defining _GNU_SOURCE appears to interfere. IIRC, this problem didn't
exist up until glibc 2.24.

Is this the expected behaviour? If so, is there a way to make bsd_signal
available whiling _GNU_SOURCE is defined?

Compiled using gcc 7.2.0/glibc 2.26 on Ubuntu 17.10.

Thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]