Skip to content

Adds CNIOFreeBSD C module and wire System.swift for FreeBSD support #3592

Draft
rafaelcepeda wants to merge 11 commits into
apple:mainfrom
rafaelcepeda:freebsd-cniofreebsd
Draft

Adds CNIOFreeBSD C module and wire System.swift for FreeBSD support #3592
rafaelcepeda wants to merge 11 commits into
apple:mainfrom
rafaelcepeda:freebsd-cniofreebsd

Conversation

@rafaelcepeda
Copy link
Copy Markdown
Contributor

@rafaelcepeda rafaelcepeda commented May 12, 2026

Expands CNIOFreeBSD from a minimal shim into a full platform support layer (mmsghdr, sendmmsg/recvmmsg, pthread wrappers, CMSG helpers, PKTINFO constants) and separates FreeBSD from the Linux import path in System.swift. This eliminates all System.swift build errors on FreeBSD, reducing the total NIOPosix error count from 101 to 89.

Motivation:

This is another step towards having FreeBSD support in SwiftNIO.

Modifications:

  • Sources/CNIOFreeBSD/include/CNIOFreeBSD.h — new type/function declarations
  • Sources/CNIOFreeBSD/shim.c — implementations for all C helpers
  • Sources/NIOPosix/System.swift — separate FreeBSD from Linux import paths throughout

Result:

NIOPosix error count on FreeBSD drops from 101 to 89, with all System.swift errors eliminated. Remaining errors are confined to files needing import CNIOFreeBSD (MemberImportVisibility) and platform-specific fixes in ThreadPosix, BSDSocketAPIPosix, SocketChannel, ControlMessage, and SocketProtocols.

@rafaelcepeda rafaelcepeda changed the title Add CNIOFreeBSD C module and wire System.swift for FreeBSD support Adds CNIOFreeBSD C module and wire System.swift for FreeBSD support May 12, 2026
@rafaelcepeda rafaelcepeda added 🔨 semver/patch No public API change. labels May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant