Comment 2 for bug 1824791

Revision history for this message
Tomasz Konojacki (xenu536) wrote :

The issue still exists, both on FreeBSD and on DragonFly BSD.

On both of those operating systems, the only right way is to not define anything. As opposed to glibc, they use feature macros only to *hide* things. By default, everything is visible in their headers.

For reference (both dragonfly and freebsd use *exactly* the same logic):

sys/cdefs.h (where _BSD_VISIBLE is defined): https://gitweb.dragonflybsd.org/dragonfly.git/blob/725e0fd894bdd515bdc7411d9d266a83e09c40ae:/sys/sys/cdefs.h#l594

sys/signal.h (SIGWINCH): https://gitweb.dragonflybsd.org/dragonfly.git/blob/725e0fd894bdd515bdc7411d9d266a83e09c40ae:/sys/sys/signal.h#l110

As you can see, SIGWINCH depends on _BSD_VISIBLE, and _BSD_VISIBLE is defined only when _POSIX_C_SOURCE, _POSIX_SOURCE, _ANSI_SOURCE, _C99_SOURCE and _C11_SOURCE are *not* defined.

IMO, the issue should be fixed by wrapping visibility macro defines with "#ifdef __GLIBC__", see the attached patch. I have tested it on FreeBSD and DragonFly BSD. I'm also 90% sure it will work on OpenBSD and NetBSD, I didn't test it, but I have read their headers.

If it breaks other platfoms (MacOS? musl?), you can simply amend those ifdefs basing on the incoming bugreports.