Skip to content

v0.3.0

@akvilary akvilary tagged this 14 Sep 03:46
Documents the three concrete gaps that force the C shim, with
toolchain-verified facts (Swift 6.2.4, Linux x86_64):

1. The Glibc module is a curated 188-include umbrella (SwiftGlibc.h):
   signal.h / sys/socket.h / sys/select.h are there — which is why tests
   call signal/socketpair directly — but sys/epoll.h, sys/eventfd.h and
   sys/timerfd.h are not. The epoll functions simply do not exist after
   `import Glibc`.
2. epoll_event is a 12-byte packed kernel ABI; Swift has no packed
   attribute ({UInt32; UInt64} lays out as 16 bytes), so a naive Swift
   struct corrupts the kernel-written buffer.
3. errno capture in C immediately after the syscall is formally
   race-free (soft argument, marked as such).

Also covers the rejected pure-Swift alternatives (raw syscall(2) with
arch-specific numbers; @_silgen_name — private attribute, links without
signature checking), the SwiftNIO/CNIOLinux precedent, the hidden
portability bonus (glibc only wrapped epoll_pwait2 upstream in 2.36;
Ubuntu 2.35 carries a backport — nm-verified — and the shim's sigsetsize
parameter is the pre-planned seam for a raw-syscall fallback), and
reproducible grep commands for every claim.

ARCHITECTURE.md cross-links to it from the CMIO section.
Assets 2
Loading