[Bug 256952] Improve the epoll for socket to be compatible with Linux

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 03 Jul 2021 08:34:58 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256952

            Bug ID: 256952
           Summary: Improve the epoll for socket to be compatible with
                    Linux
           Product: Base System
           Version: 13.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs_at_FreeBSD.org
          Reporter: vico13.chen_at_gmail.com

Created attachment 226189
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=226189&action=edit
Introduce 'pevents' in kevent to record the poll events, and handle them in
'linux_event.c' to report correct epoll events to match Linux behavior.

The epoll behavior for Unix socket is:
1. If both sender and receiver are shutdown, Linux reports 'EPOLLHUP'
2. If only receiver is shutdown, Linux reports 'EPOLLRDHUP | EPOLLRDNORM |
EPOLLIN'.
3. For EPOLL error, Linux reports it with other epoll events but not report
epoll error only once error detected.

The current code for socket only handles 'CANTRCVMORE' (receiver shutdown) in
kevent filter read and only handle 'CANTSENDMORE' in kevent filter write. 

For Linux, the epoll behaviors, like pipe, socket, are quite different. And
this patch creates a new mechanism to report epoll events according to each
component, and this patch only fixes the socket case to align Linux epoll
behavior, and other components, like pipe, can be improved based on the new
mechanism.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Sat Jul 03 2021 - 08:34:58 UTC

Original text of this message