Closed komh closed 8 months ago
This LIBCn change was intentional, see #124 and #128 for details. What about the compatibility with kLIBC, I already mentioned in #137 that kLIBC and LIBCn should not be mixed and all current code should be updated towards the recent POSIX specs (and LIBCn). Which means your code sample should not build on recent GNU/Linux systems either until you fix it.
Please show your real life case if you want me to reconsider.
The above sample code is built fine on GNU/Linux systems without any problems whether or not -D_GNU_SOURCE is given.
If only _POSIX_C_SOURCE is defined, #ifdef guards may have meanings. However, _GNU_SOURCE defines other macros such as _BSD_SOURCE, too. Therefore, ESHUTDOWN should be defined even if _POSIX_C_SOURCE is defined.
Otherwise, how can I use ESHUTDOWN when _GNU_SOURCE is defined ?
GLIBC defines both _POSIX_SOURCE and _POSIX_C_SOURCE and we depend on that in recent software. However, GLIBC doesn't use _BSD_SOURCE and this is where things go south for us. So may be we should indeed do as you suggest.
I found this exact issue as well while working on gnutls tests. ESHUTDOWN is just not defined, as guarded by #ifndef _POSIX_SOURCE
Hi/2.
_GNU_SOURCE
enables all the features including_POSIX_SOURCE
and_POSIX_C_SOURCE
. However, kLIBC does not enable_POSIX_SOURCE
and_POSIX_C_SOURCE
for the compatibility with EMX headers even with_GNU_SOURCE
enabled .OTOH, LIBCn enables both them if
_GNU_SOURCE
is enabled. This breaks the compatibility with kLIBC. For example,ESHUTDOWN
is defined when_POSIX_SOURCE
is not defined. See https://github.com/bitwiseworks/libc/blob/b246be5f6d3d9ff751e1d527dc3a945fbaf1ed76/src/emx/include/sys/errno.h#L143-L146On kLIBC, there are no problems because
_GNU_SOURCE
does not define_POSIX_SOURCE
. However, on LIBCn, this is defined by that.So I think,
_POSIX_SOURCE
guards should be modified to check additional feature test macros such as__USE_EMX
like:#ifndef _POSIX_SOURCE
to#if !defined(_POSIX_SOURCE) || defined(__USE_EMX)
This modified guard is already used in many places.
And this should be applied to
_POSIX_C_SOURCE
.