bytecodealliance / bytecodealliance/rustix

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

Open
#1,579 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.1k
Forks
294
Avg merge
4h 7m
Merged PRs (30d)
2

Description

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:

```rust
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
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.