On Sat, May 25, 2013 at 10:22:02AM -0700, Paul Eggert wrote: > On 05/25/2013 07:51 AM, Jack Howarth wrote: > > I am a bit unclear on that issue. Does darwin lack the complete posix > > support required for > > freadahead.c, freadptr.c, fseterr.c and fseeko.c to be rewritten to support > > compiling with > > -D_POSIX_C_SOURCE (at least for modern darwin releases)? Or has it just > > never been implemented > > in order to maintain support for legacy versions of darwin? > > Sorry, I don't know Darwin. But my guess is that applications > routinely need to define _DARWIN_C_SOURCE to get their work > done. > > I'm a bit puzzled by this case. If I understand > https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/compat.5.html > correctly, _DARWIN_C_SOURCE nowadays means "conform to POSIX, > but add non-POSIX extensions even if that violates the POSIX > namespace rules", which is normally what we want. And yet here, > _DARWIN_C_SOURCE seems to mean "change getgroups() so that it > no longer works right". What gives? If Apple has > a little "POSIX world" to pacify the standards nerds, but it's > a world that actual programs would never really want to use, > then we don't want to use it either. > > The BUGS section of that manual page says that the behavior > is dubious if you compile different sections of a program with > different flags, so I'd prefer a solution that didn't require > disabling _DARWIN_C_SOURCE just for this.
I think the _DARWIN_UNLIMITED_GETGROUPS issue may be a red herring. Passing -D_DARWIN_UNLIMITED_GETGROUPS to CFLAGS didn't eliminate any of the failures and the only instance of _DARWIN_UNLIMITED_GETGROUPS in the headers in /usr/include for Mac OS X 10.8 are in unistd.h. These are... #ifdef _DARWIN_UNLIMITED_GETGROUPS #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 #error "_DARWIN_UNLIMITED_GETGROUPS specified, but -miphoneos-version-min version does not support it." #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6 #error "_DARWIN_UNLIMITED_GETGROUPS specified, but -mmacosx-version-min version does not support it." #endif #endif and #if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE) int getgroups(int, gid_t []) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(getgroups)); #else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */ int getgroups(int, gid_t []); #endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */ which sugggests that _DARWIN_C_SOURCE and _DARWIN_UNLIMITED_GETGROUPS use the same extension for getgroups.