[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 UTC

            Bug ID: 256952
           Summary: Improve the epoll for socket to be compatible with
           Product: Base System
           Version: 13.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: vico13.chen@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 |
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

You are receiving this mail because:
You are the assignee for the bug.