strerror_r and addrinfo require _POSIX_C_SOURCE >= 200112L, which is
implied by _XOPEN_SOURCE >= 600. With the removal of AF_LOCAL usage,
the only non-standard features being used are the TCP_KEEP* socket
flags. _DARWIN_C_SOURCE is required to expose TCP_KEEPALIVE.
Fall back to using _XOPEN_SOURCE 600 for all platforms, and
additionally define _DARWIN_C_SOURCE for Darwin.
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
Fix strerror_r on some esoteric platforms
Defining _XOPEN_SOURCE=1 causes strange behavior on Debian kfreebsd archs -- i.e. the GNU userspace with FreeBSD kernel -- when _GNU_SOURCE is not defined (the default).
Not sure I fully understand the bizarre semantics, but it seems to use the XSI-compliant interface (int strerror_r(int, char*, size_t)) but the GNU implementation (char *strerror_r(int, char*, size_t)) such that strerror_r returns 32-bits of a 64-bit char * on x86_64 kfreebsd. We would expect strerror_r to return zero when using the XSI-compliant strerror_r implementation or a 64-bit char* when using the GNU version. Instead, we get something in between!
Unless I'm missing something, being more explicit about what version of _XOPEN_SOURCE we want seems to be the prudent thing to do here -- and if folks want the GNU implementation of strerror_r for some reason they can always -D_GNU_SOURCE explicitly.
Defining _XOPEN_SOURCE=1 causes strange behavior on Debian kfreebsd
archs (i.e. GNU userspace with FreeBSD kernel) when _GNU_SOURCE is not
defined.
Not sure I fully understand the bizarre semantics, but it seems to
use the XSI-compliant interface
(int strerror_r(int, char*, size_t)) but the GNU implementation
(char *strerror_r(int, char*, size_t)) such that strerror_r returns
32-bits of a 64-bit char * on x86_64 kfreebsd. We would expect
strerror_r to return zero when using the XSI-compliant strerror_r
implementation or a 64-bit char* when using the GNU version. Instead,
we get something in between!
Unless I'm missing something, being more explicit about what version
of _XOPEN_SOURCE we want seems to be the prudent thing to do here --
and if folks want the GNU implementation of strerror_r for some reason
they can always -D_GNU_SOURCE explicitly.