Hallvard B Furuseth h.b.furuseth@usit.uio.no writes:
Should _BSD_SOURCE or _SVID_SOURCE provide struct ucred? If so the problem this time is hopefully only that he didn't know the struct is not a Gnu invention.
Pure System V does this a different way, so I doubt _SVID_SOURCE should. Not sure about _BSD_SOURCE; that would be the most likely one. Note that _GNU_SOURCE isn't only used for GNU extensions; it's basically used for anything that doesn't fall into a clear standard.
So protecting with _GNU_SOURCE doesn't mean that glibc maintainers think it's a uniquely GNU extension, just that they don't think it falls into one of the other standard feature-test macros.
Well, headers in several OSes broke at least some years ago when one #defined feature test macros like _POSIX_SOURCE. IIRC including some glibc headers. Still, they've all had decades to clean up now.
These days, I basically always use the AC_GNU_SOURCE Autoconf macro to define _GNU_SOURCE, since I almost always run into something that glibc hides unless you define _GNU_SOURCE. Unless you're trying to maintain tight control over what enters your namespace, fighting with the standardized feature-test macros is often more trouble than it's worth.