Details
- Reviewers
- kib - pauamma_gundo.com - markj - jmg 
- Group Reviewers
- manpages - Linux Emulation 
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
- Lint Passed 
- Unit
- No Test Coverage 
- Build Status
- Buildable 45515 - Build 42403: arc lint + arc unit 
Event Timeline
Manual page change is probably small enough to be fixed while committing if nothing else needs revision. (As always, I can't attest to source change or consistency between it and manual page.)
| lib/libc/sys/kqueue.2 | ||
|---|---|---|
| 289–290 | ||
Thank you! Since I don't really understand the role of influx in kevent() I won't commit until Kostya criticizes kqueue_sccan changes
Please, see my previous comment, also it would be nice to test in the real environment
Reading the description of EPOLLEXCLUSIVE from the epoll_ctl manual page, this looks like it provides the wrong semantics. The use-case for EPOLLEXCLUSIVE seems to be that you have multiple epoll descriptors being used to monitor events on a single object; when an event occurs, only one of the epoll descriptors will receive the event. In the Linuxulator there is a 1-1 correspondence between kqueues and epoll descriptors. You are translating EPOLLEXCLUSIVE to a per-knote flag, and if N kqueues contain an event for a given resource, there will be N independent knotes. The tests work because they use a single kqueue, but I believe that epoll semantics require EV_EXCLUSIVE to work across multiple kqueues. I believe it is unusual to have multiple threads sharing a kqueue anyway; see https://www.usenix.org/system/files/atc21-zhao.pdf
So, I would expect an implementation of EPOLLEXCLUSIVE to, at least, modify knote() such that we avoid activating more than one knote with EV_EXCLUSIVE set.
| lib/libc/sys/kqueue.2 | ||
|---|---|---|
| 282 | The flag applies to the knote, not the entire queue. | |
| sys/kern/kern_event.c | ||
| 2074 | There is no need to add a separate case, you can change line 2061 to if ((kn->kn_flags & EV_CLEAR | EV_DISPATCH | EV_EXCLUSIVE)) != 0) { and the behaviour will be unchanged. | |