kqueue: Don't notify B_EVENT_INVALID for FDs.

It isn't sent at all on FreeBSD.

Found while testing #19969: the disconnection was reported twice.

Change-Id: Icaf7abef7c3c3a61fccf5eb9e827e0a6a0fa1228
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10580
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2026-03-27 01:13:34 +00:00
committed by waddlesplash
parent 498d92cbd7
commit e6d9dc2731
+6 -5
View File
@@ -76,7 +76,8 @@ kevent(int kq,
break;
default:
return EINVAL;
__set_errno(EINVAL);
return -1;
}
if ((changelist[i].flags & EV_ONESHOT) != 0)
@@ -207,13 +208,11 @@ kevent(int kq,
if (waitInfos[i].events < 0) {
flags |= EV_ERROR;
data = waitInfos[i].events;
} else if ((waitInfos[i].events & B_EVENT_DISCONNECTED) != 0) {
flags |= EV_EOF;
} else if ((waitInfos[i].events & B_EVENT_INVALID) != 0) {
switch (waitInfos[i].type) {
case B_OBJECT_TYPE_FD:
flags |= EV_EOF;
break;
// File descriptor was closed. Silently discard the event.
continue;
case B_OBJECT_TYPE_THREAD: {
fflags |= NOTE_EXIT;
@@ -227,6 +226,8 @@ kevent(int kq,
break;
}
}
} else if ((waitInfos[i].events & B_EVENT_DISCONNECTED) != 0) {
flags |= EV_EOF;
} else if ((waitInfos[i].events & B_EVENT_ERROR) != 0) {
flags |= EV_ERROR;
data = EINVAL;