darwin: replace EV_OOBAND handling with EVFILT_EXCEPT + NOTE_OOB (#4906)

Fixes: https://github.com/libuv/libuv/issues/3947
Re-lands: https://github.com/libuv/libuv/pull/4597

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
Juan José 2026-03-16 21:23:06 -05:00 committed by GitHub
parent f600f7180a
commit 6f096c9d03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -229,7 +229,16 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
}
if ((w->events & UV__POLLPRI) == 0 && (w->pevents & UV__POLLPRI) != 0) {
#ifdef __APPLE__
/*
* Use EVFILT_EXCEPT+ NOTE_OOB for macOS since it defines this flag.
* FreeBSD does not.
* Refs: https://github.com/libuv/libuv/issues/3947
*/
EV_SET(events + nevents, w->fd, EVFILT_EXCEPT, EV_ADD, NOTE_OOB, 0, 0);
#else
EV_SET(events + nevents, w->fd, EV_OOBAND, EV_ADD, 0, 0, 0);
#endif
if (++nevents == ARRAY_SIZE(events)) {
if (kevent(loop->backend_fd, events, nevents, NULL, 0, NULL))
@ -369,7 +378,12 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
revents |= UV__POLLRDHUP;
}
#ifdef __APPLE__
/* Match EVFILT_EXCEPT used above for macOS. */
if (ev->filter == EVFILT_EXCEPT) {
#else
if (ev->filter == EV_OOBAND) {
#endif
if (w->pevents & UV__POLLPRI)
revents |= UV__POLLPRI;
else