Workaround an issue caused by a flag

When we pass back EV_VANISHED to libdispatch, it thinks we're telling it the source vanished (because that's really what it means) and it explodes
This commit is contained in:
Ariel Abreu 2020-10-06 08:28:31 -04:00
parent 3c34d903b4
commit 9a94fadf15
No known key found for this signature in database
GPG Key ID: ECF8C2B9E8AD3E6B
2 changed files with 9 additions and 0 deletions

View File

@ -107,6 +107,9 @@ struct kevent {
#define EV_RECEIPT 0x0040 /* force EV_ERROR on success, data=0 */
#define EV_DISPATCH 0x0080 /* disable event after reporting */
#define EV_UDATA_SPECIFIC 0x0100 /* unique kevent per udata value */
#define EV_VANISHED 0x0200 /* report that source has vanished */
#define EV_SYSFLAGS 0xF000 /* reserved by system */
#define EV_FLAG1 0x2000 /* filter-specific flag */

View File

@ -147,6 +147,12 @@ kevent_copyin_one(struct kqueue *kq, const struct kevent64_s *src)
kn->kn_kq = kq;
assert(filt->kn_create);
// TODO: actually handle EV_VANISHED
// this is necessary for now because if we pass back EV_VANISHED, it indicates
// the source has vanished. we want to do that once we start properly handling it and checking for it,
// but at the moment it just confuses clients
kn->kev.flags &= ~EV_VANISHED;
if (filt->kn_create(filt, kn) < 0) {
knote_release(kn);
errno = EBADF;