[Bug 256952] kqueue(2): Improve epoll Linux compatibility (compat/linux/linux_event)

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 09 Aug 2021 08:54:11 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256952

--- Comment #5 from Vico <vico13.chen_at_gmail.com> ---
Comment on attachment 227028
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=227028
note_hup.patch

Hi Vladimir,
I have several questions:

1. For 'LINUX_EPOLL_EVRD', it is defined only as
“LINUX_EPOLLIN|LINUX_EPOLLRDNORM". If the user call epoll with only
"EPOLLRDHUP", then filter will be no actions.

2. The Linux behavior for Linux are:
    a.If both sender and receiver are shutdown, Linux reports 'EPOLLHUP |
EPOLLRDHUP | EPOLLRDNORM | EPOLLIN'
    b.If only receiver is shutdown, Linux reports 'EPOLLRDHUP | EPOLLRDNORM |
EPOLLIN'.
    c. For EPOLL error, Linux reports it with other epoll events but not report
epoll error only once error detected.
    d. LINUX_EPOLLERR and LINUX_EPOLLHUP are always in EPOLL mask.
    For this patch, based on Linux behavior a) and b), EPOLLRDNORM is missed
for socket. 

3. No masks for this patch. For example, if the applications only request
EPOLLHUP, but EPOLLIN is detected, the applicaiton will be waken up and catch
EPOLLIN.

It is better to design a generic framework to handle all cases to match Linux
behavior. And let each module to handle its own EPOLL events, for example,
socket knows its own epoll behavior, and pipe knows its own epoll behavior, and
epoll_to_kevent is a generic handling.

Please refer https://reviews.freebsd.org/D31037, as someone has concerns to
introduce pevent and pmask in kevent structure. Coudl you please help clarify
the issue?

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Mon Aug 09 2021 - 08:54:11 UTC

Original text of this message