-
Notifications
You must be signed in to change notification settings - Fork 724
Description
The new Epoll API (as at nix 0.27) should be marked unsafe, probably on Epoll::add().
Currently the API has no unsafe on it, uses types from the io-safety proposal - but is in fact unsafe. Because one can add a file descriptor to an Epoll's set of interests, and then drop that file descriptor - which is just what io-safety was trying to prevent.
Useful discussion starts at #2115 (comment).
(Original report preserved below)
I'm interacting with a C library so I have a RawFd all along.
Previously epoll_ctl() etc took a RawFd so that was very convenient. But the new API takes Fd: AsFd which is not so convenient: I have to unsafely borrow my RawFd; and then nix is only going to .as_raw_fd() it again anyway. It's an awkward and unnecessary dance.
Fd: AsRawFd might make more sense, I reckon that's what is actually needed?