Skip to content

Event::fflags() accessor missing for EVFILT_READ/EVFILT_WRITE kqueue events #1579

@larseggert

Description

@larseggert

The event::kqueue::Event struct does not expose the fflags field of the underlying kevent for EVFILT_READ and EVFILT_WRITE events. That field is currently only accessible indirectly through the filter() method for EVFILT_VNODE, EVFILT_PROC and EVFILT_USER.

Per the kqueue(2) man page on macOS/FreeBSD:

If the read direction of the socket has shutdown, then the filter also sets EV_EOF in flags, and returns the socket error (if any) in fflags.

So it is kinda important to have access to that. There are workarounds of course, but an accessor would be cleaner:

  impl Event {
      /// Get the filter-specific flags for this event.
      ///
      /// For `EVFILT_READ`/`EVFILT_WRITE` on sockets, this contains the socket
      /// error (e.g. `ECONNRESET`) when `EV_EOF` is set in `flags()`.
      pub fn fflags(&self) -> u32 {
          self.inner.fflags
      }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions