kqueue_poll() reported POLLIN when kq_count was non-zero. kq_count is the number of queued knotes, which is only an upper bound on the events that kevent(2) returns: a knote is queued when its filter fires, but is removed only by kqueue_scan(), which rechecks the filter. E.g. EVFILT_USER reset by EV_CLEAR after NOTE_TRIGGER, a disabled knote, or EVFILT_READ on a pipe drained by read(2), stay queued, poll(2) returns POLLIN, and then kevent(2) returns nothing, or blocks. Add a peek mode to kqueue_scan(), where the events are counted but not reported, and stay queued, while the knotes without events are discarded as usual. kqueue_poll() runs it with maxevents 1 before checking kq_count. EVFILT_READ on a kqueue still reports kq_count, since filt_kqueue() is called with the kqueue lock owned.
Details
Details
- Reviewers
markj
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped