debug_server: use _DARWIN_C_SOURCE on macOS for full BSD+POSIX namespace

On macOS, defining _POSIX_C_SOURCE restricts the visible namespace and HIDES
BSD symbols the TCP debug server needs — notably INADDR_LOOPBACK (and
struct timeval). clang then fails with 'use of undeclared identifier
INADDR_LOOPBACK'. Use _DARWIN_C_SOURCE on Apple (which exposes the full
BSD+POSIX namespace incl. clock_gettime), keeping _POSIX_C_SOURCE for glibc.

Mirrors the same __APPLE__/_DARWIN_C_SOURCE guard already used in psx_fiber.c.
This commit is contained in:
Matthew Stanley
2026-06-12 19:30:50 -07:00
committed by Matt Stanley
parent 2cd5d22773
commit eec3d7893d
+3 -1
View File
@@ -9,7 +9,9 @@
*/
/* Expose POSIX clock_gettime()/CLOCK_MONOTONIC (used by monotonic_ms) on
* glibc — must precede any system header. Harmless on Windows/macOS. */
#ifndef _POSIX_C_SOURCE
#ifdef __APPLE__
# define _DARWIN_C_SOURCE 1 /* full BSD+POSIX namespace: clock_gettime AND INADDR_LOOPBACK/timeval */
#elif !defined(_POSIX_C_SOURCE)
# define _POSIX_C_SOURCE 200809L
#endif
#include <time.h>