Repository navigation
Description
Problem
The macOS _delete_filters helper discards the return from kevent, and event_remove always returns 0. Invalid/closed kqueue handles are therefore reported as successfully updated. event_modify also ignores the deletion result before adding replacement filters.
The FreeBSD implementation already checks each deletion and distinguishes missing filters from real errors; this issue concerns the macOS provider.
Starting points: std/sys/macos/event.wave, std/sys/freebsd/event.wave.
Reproduction
At 4c3372157d8889fa8bbef0a7ccd2e72aab1c5c6c, event_remove(-1, 0) returns 0. A Linux-hosted O0/O2 mock-boundary test directly imported the checkout macOS event provider and supplied kevent(...) = -1 and __error() = &EBADF (9). This verifies the discarded result, not native Darwin kernel behavior.
A native macOS regression can use:
import("std::sys::event")::{event_remove};
fun main() -> i32 {
if (event_remove(-1, 0) == -9) { return 0; }
return 1;
}
With the matching checkout std, build/run at O0 and O2. The expected exit is 0; the source path and mock both produce 1. Apple's kevent return contract describes -1/errno failures.
Scope
Propagate real deletion failures through event_remove and event_modify, and handle absent read/write filters deliberately. Ensure one absent filter does not silently prevent cleanup of the other. Preserve existing public event types and native errno reporting. Related Darwin ABI audit: #434; this is a specific error-propagation defect.
Difficulty: medium.
Completion criteria
- Invalid/closed queue handles return the relevant negative errno.
- Removing read-only, write-only and combined registrations does not leave an unnoticed live filter.
- An unsuccessful modification does not report success after an unhandled deletion failure.
- Add native macOS coverage for both architectures plus deterministic OS-boundary failure tests.
Activity