If an error occurs while processing an element of the changelist and there is enough room in the eventlist, then the event will be placed in the eventlist with EV_ERROR set in flags and the system error in data.
This is done correctly in kevent_copyin however line 295 is rv = 0;, kevent then assigns the number of triggered events to rv and finally rv is returned. This means only the number of triggered events is returned rather than the number of failures and triggered events.
I think the fix is quite simple: track number of failures.
I can do the fix, I just want to confirm my analysis is accurate.
In the case that applying the changelist fails, the return value of of
kqueue
will be incorrect.Code section that this applies to:
https://github.com/mheily/libkqueue/blob/master/src/common/kevent.c#L282-L315
The spec states that:
This is done correctly in
kevent_copyin
however line 295 isrv = 0;
,kevent
then assigns the number of triggered events torv
and finallyrv
is returned. This means only the number of triggered events is returned rather than the number of failures and triggered events.I think the fix is quite simple: track number of failures.
I can do the fix, I just want to confirm my analysis is accurate.