Description
My writing is motivated by my attempt to start working on an OpenBSD port for ghostty. Currently at the top of the yak stack is building libxev on OpenBSD. The build is currently hardcoded to fail because the kqueue backend depends on mach ports. From what I can tell, the mach port facility is used in libxev on darwin as a mechanism to trigger a kevent from user code, i.e. through the notify()
implementation on AsyncMachPort
.
OpenBSD just got the EVFILT_USER
kevent type (should be in this fall's OpenBSD 7.8 release and in the next snapshots of -current), previously found in FreeBSD and NetBSD, so it should be possible to use it on all three of those platforms to fill the same role. (I'm not sure about Dragonfly, they seem to be having web server problems.) So the Loop/Async interaction would boil down to the Loop adding a watch for EVFILT_USER
on the kqueue fd and the Async sending such an event.
I'd be trying to hack a patch together that does this at this point but there's not actually a new OpenBSD snapshot built yet with EVFILT_USER
so I personally am not in a position to mess with it until that happens. But I was looking into it this today and wanted to write down my findings.