Handle no-event case in copyin for EVFILT_MACHPORT

This commit is contained in:
Ariel Abreu 2022-02-20 01:03:17 -05:00
parent 532529e49c
commit bcef9ea04b
No known key found for this signature in database
GPG Key ID: D67AE16CCEA85B70

View File

@ -83,6 +83,13 @@ evfilt_machport_copyout(struct kevent64_s *dst, struct knote *src, void *ptr)
return -1;
}
if (reply.header.code == 0xdead) {
// server indicated there was actually no event available to read right now;
// drop the event
dst->filter = 0;
return 0;
}
if (reply.header.code != 0) {
// FIXME: the returned code is actually a Linux code (but strerror is provided by Darwin libc here)
dbg_printf("evfilt_machport_copyout() server indicated failure: %d (%s)", -reply.header.code, strerror(-reply.header.code));