P4.2: declare fcntl as varargs in debug-repl FFI
ober
009614be61a6e11bb7b9b120fe0d80a2a3933812
--- a/src/jcode/core/debug-repl.ss +++ b/src/jcode/core/debug-repl.ss @@ -49,7 +49,13 @@ (def c-setsockopt (foreign-procedure "setsockopt" (int int int void* int) int)) (def c-htons (foreign-procedure "htons" (unsigned-short) unsigned-short)) (def c-getsockname (foreign-procedure "getsockname" (int void* void*) int)) -(def c-fcntl (foreign-procedure "fcntl" (int int int) int)) +;; P4.2: fcntl is varargs (int int, ...). On macOS arm64 fixed-args use +;; one register file and varargs another — declaring a fixed (int int int) +;; binding lands the third arg in the wrong slot and the kernel sees junk +;; (F_SETFL silently rejects, set-nonblocking! becomes a no-op, then the +;; accept thread blocks every other green thread). __varargs_after marks +;; the variadic boundary so Chez uses the right calling convention. +(def c-fcntl (foreign-procedure (__varargs_after 2) "fcntl" (int int int) int)) (def c-dup (foreign-procedure "dup" (int) int)) (def c-errno-location