Skip to content

SelectorGeneric, SelectorKqueue, and NonBlockingFileIO successfully compile on FreeBSD#3588

Open
rafaelcepeda wants to merge 10 commits into
apple:mainfrom
rafaelcepeda:freebsd-nioposix
Open

SelectorGeneric, SelectorKqueue, and NonBlockingFileIO successfully compile on FreeBSD#3588
rafaelcepeda wants to merge 10 commits into
apple:mainfrom
rafaelcepeda:freebsd-nioposix

Conversation

@rafaelcepeda

Copy link
Copy Markdown
Contributor

The kqueue selector backend now works on FreeBSD, EVFILT_EXCEPT is properly guarded for Darwin/OpenBSD only, d_fileno is used on FreeBSD, and sysFstat/sysKevent/KQueue enum are enabled for FreeBSD.

Motivation:

This is a small step towards making NIOPosix fully compile on FreeBSD.

Modifications:

Changed SelectorGeneric, SelectorKqueue, and NonBlockingFileIO files to ensure they correctly compile on FreeBSD.

Result:

Indicated files now compile with no errors on FreeBSD.

@rafaelcepeda rafaelcepeda added the 🔨 semver/patch No public API change. label May 11, 2026
@rafaelcepeda rafaelcepeda changed the title SelectorGeneric, SelectorKqueue, or NonBlockingFileIO successfully compile on FreeBSD SelectorGeneric, SelectorKqueue, and NonBlockingFileIO successfully compile on FreeBSD May 11, 2026
]
#else
let eventFilters: [(KQueueEventFilterSet, CInt)] = [
(.read, CInt(EVFILT_READ)), (.write, CInt(EVFILT_WRITE)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it okay to not have the except filter here? Are we effectively changing some behaviour in an unexpected way?

private let sysSendMmsg = CNIOLinux_sendmmsg
private let sysRecvMmsg = CNIOLinux_recvmmsg
#elseif os(FreeBSD)
private let sysKevent = kevent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's also potentially suspicious we're not defining any of the other lets here since we do for other platforms. What's the reason?

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.

2 participants