On Sun, Dec 27, 2020 at 05:09:46PM +0000, Visa Hankala wrote:
> This patch revises the way how kqueue notifies select(2) about the
> closing of monitored file descriptors. Instead of returning EBADF through
> kqueue_scan(), the error is conveyed in struct kevent. This is excessive
> for select(2) but should be useful with kqueue-based poll(2).

Actually, I think it is possible to implement kqueue-based poll(2)
with fd close handling using the existing kqueue functionality.
In the rare case where kqueue_scan() returns EBADF, which tells that
a monitored file descriptor has been closed, kqueue-based poll(2)
could rerun its kqueue_register() calls without the EV_ADD flag.
This lets the code check the status of the initial event registrations
without interference from quick fd reuse.

Reply via email to