From 4098b252bc0344a27ee2cedf4c5ae52e7b3319ef Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Sat, 13 Jun 2026 09:44:03 +0000 Subject: [PATCH] fix(abi): exclude internal Apple recvmsg_x FFI from the C header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cbindgen swept transport/udp.rs's `recvmsg_x` foreign import and its `MsghdrX` #[repr(C)] struct into the generated C header — they're internal Apple-only FFI, not part of the public C ABI, and reference socklen_t/ssize_t/iovec which the C ABI harness doesn't include, so c_abi_harness_round_trips failed to compile. Add them to cbindgen.toml export.exclude and regenerate the header. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/punktfunk-core/cbindgen.toml | 6 ++++++ include/punktfunk_core.h | 16 ---------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/crates/punktfunk-core/cbindgen.toml b/crates/punktfunk-core/cbindgen.toml index df7aa21..4bfbb53 100644 --- a/crates/punktfunk-core/cbindgen.toml +++ b/crates/punktfunk-core/cbindgen.toml @@ -12,6 +12,12 @@ documentation_style = "c99" [parse] parse_deps = false +[export] +# Internal Apple-only FFI (transport/udp.rs `recvmsg_x` batched recv + its `MsghdrX`) — NOT part of +# the C ABI. cbindgen otherwise sweeps the foreign import and its #[repr(C)] struct into the header, +# where socklen_t/ssize_t/iovec are undefined and the C harness fails to compile. +exclude = ["MsghdrX", "recvmsg_x"] + [export.rename] "InputEvent" = "PunktfunkInputEvent" "InputKind" = "PunktfunkInputKind" diff --git a/include/punktfunk_core.h b/include/punktfunk_core.h index 82d82db..cef501e 100644 --- a/include/punktfunk_core.h +++ b/include/punktfunk_core.h @@ -470,18 +470,6 @@ typedef struct { float loss_pct; } PunktfunkProbeResult; -// `struct msghdr_x` from Darwin `` (the batched-I/O variant — not in the `libc` crate). -typedef struct { - void *msg_name; - socklen_t msg_namelen; - iovec *msg_iov; - int msg_iovlen; - void *msg_control; - socklen_t msg_controllen; - int msg_flags; - size_t msg_datalen; -} MsghdrX; - #ifdef __cplusplus extern "C" { #endif // __cplusplus @@ -899,10 +887,6 @@ PunktfunkStatus punktfunk_connection_probe_result(const PunktfunkConnection *c, void punktfunk_connection_close(PunktfunkConnection *c); #endif -// Darwin batched receive: up to `cnt` datagrams in one syscall; returns the count received and -// sets each `msg_datalen` to its byte length. Present in libSystem on all macOS/iOS. -extern ssize_t recvmsg_x(int s, MsghdrX *msgp, unsigned int cnt, int flags); - #ifdef __cplusplus } // extern "C" #endif // __cplusplus