Merge security/p4.2-fcntl-varargs
ober
4875c10959d0b5397930c032a06e3b64e73403da
--- 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