add _DARWIN_C_SOURCE_MACRO to stop _POSIX_C_SOURCE from clobbering BSD types. what a mess...