Skip to content

Include poll.h and shim MSG_NOSIGNAL in socket.c for non-Linux POSIX#4

Merged
draxinar merged 1 commit into
draxinar:mainfrom
johnmatter:fix/macos-socket-portability
May 12, 2026
Merged

Include poll.h and shim MSG_NOSIGNAL in socket.c for non-Linux POSIX#4
draxinar merged 1 commit into
draxinar:mainfrom
johnmatter:fix/macos-socket-portability

Conversation

@johnmatter
Copy link
Copy Markdown
Contributor

This makes OUO build/run on Apple Silicon.

  • socket.c references MSG_NOSIGNAL and uses poll() outside the Linux epoll path, but never includes <poll.h> and assumes the GNU-only MSG_NOSIGNAL flag is defined.
  • macOS provides poll() via <poll.h> and suppresses SIGPIPE via setsockopt/SO_NOSIGPIPE instead, so the flag isn't defined — adding the include and a #define MSG_NOSIGNAL 0 fallback for non-Linux gets the file compiling and running cleanly.
  • No behavior change on Linux from what I can tell.
  • Tested by booting against a custom shard on macOS 25.4, connecting via TCP, clean shutdown.

Let me know if you have any concerns :)

Copy link
Copy Markdown
Owner

@draxinar draxinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.

Please rename the commit message so it's prefixed by the name of the subsystem, like:

socket: include poll.h and shim MSG_NOSIGNAL in socket.c for non-Linux POSIX

@johnmatter johnmatter force-pushed the fix/macos-socket-portability branch from 9db4be6 to 3f08fdb Compare May 12, 2026 03:31
@johnmatter
Copy link
Copy Markdown
Contributor Author

done! Thanks for the quick response

@draxinar draxinar merged commit fd76750 into draxinar:main May 12, 2026
6 checks passed
@johnmatter johnmatter deleted the fix/macos-socket-portability branch May 13, 2026 02:55
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.

2 participants