this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use given kqueue in kevent_qos

I'm not quite sure why we used to always create our own kqueue, but that could cause all sorts of issues. For example, if the user decided to add events via a different kevent call and then use kevent_qos to poll, they wouldn't get any events because we're actually listening to a different kqueue. Another example: since the kqueue was always shared between kevent_qos calls, different kqueue fds called on kevent_qos would all operate on the same kqueue.

Of course, in the `kq=-1` case, we still perform the correct behavior of using our default kqueue. But if the user gave us a kqueue, let's use it.

+6 -4
+6 -4
src/kernel/emulation/linux/kqueue/kevent_qos.c
··· 37 37 if ((kq == -1) != !!(flags & KEVENT_FLAG_WORKQ)) 38 38 return -EINVAL; 39 39 40 - if (default_kq == -1) 41 - { 42 - default_kq = sys_kqueue(); 40 + if (kq < 0) { 41 + if (default_kq == -1) { 42 + default_kq = sys_kqueue(); 43 + } 44 + kq = default_kq; 43 45 } 44 46 45 47 if (changelist != NULL && nchanges > 0) ··· 59 61 eventlist64 = (struct kevent64_s*) __builtin_alloca(nevents * sizeof(struct kevent64_s)); 60 62 } 61 63 62 - rv = kevent64(default_kq, changelist64, nchanges, eventlist64, nevents, flags, (flags & KEVENT_FLAG_IMMEDIATE) ? &polling_timeout : NULL); 64 + rv = kevent64(kq, changelist64, nchanges, eventlist64, nevents, flags, (flags & KEVENT_FLAG_IMMEDIATE) ? &polling_timeout : NULL); 63 65 64 66 if (rv > 0) 65 67 {