Skip to content

Add BSD support (OpenBSD, FreeBSD)#158

Merged
gafferongames merged 3 commits into
mainfrom
bsd-support
Jul 11, 2026
Merged

Add BSD support (OpenBSD, FreeBSD)#158
gafferongames merged 3 commits into
mainfrom
bsd-support

Conversation

@gafferongames

Copy link
Copy Markdown
Contributor

Two fixes that make netcode build and pass its full test suite on the BSDs, verified on OpenBSD 7.9/arm64 (all 44 tests) and macOS/Linux via CI:

  • The time/sleep platform block now covers all unix systems via NETCODE_PLATFORM_UNIX instead of only __linux, and falls back to CLOCK_MONOTONIC on systems without the linux-specific CLOCK_MONOTONIC_RAW.
  • Socket creation backs off SO_SNDBUF/SO_RCVBUF requests to the OS limit instead of failing: the BSDs reject requests above sb_max / kern.ipc.maxsockbuf (both default 2MB) with ENOBUFS instead of clamping like linux and windows, so the default 4MB request made every socket create fail. The request is halved until accepted (floor 256KB) and a reduction is logged at INFO level.

Version is bumped to 1.3.5. This unblocks the OpenBSD ports submission (and FreeBSD packaging).

🤖 Generated with Claude Code

gafferongames and others added 3 commits July 11, 2026 17:02
The time/sleep platform block now covers all unix systems via
NETCODE_PLATFORM_UNIX instead of only __linux, and falls back to
CLOCK_MONOTONIC on systems that do not have the linux-specific
CLOCK_MONOTONIC_RAW (the BSDs).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Linux and windows clamp SO_SNDBUF/SO_RCVBUF requests that exceed the OS
limit, but the BSDs reject them with ENOBUFS. OpenBSD's default sb_max is
2MB, so requesting the default 4MB socket buffers made every socket
create fail and no client or server could start. Halve the request until
the OS accepts it (floor 256KB, then fail as before) and log at INFO
level when the size was reduced.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gafferongames gafferongames merged commit fbb22f8 into main Jul 11, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant