Description
I'm a heavy user of poll
and a standard idiom is to create n entries, but not to use all of them at all times --- poll
allows fd
to have a value of -1
to say "ignore this entry". This means that one can simplify a lot of code surrounding poll
by assuming a constant number of entries at all times, even if some of them aren't doing anything.
The change to use PollFd
in 0.27 means that, as far as I can tell, this is no longer possible in nix? Here's an example of this being used in real code so it's genuinely a useful feature.
Because PollFd
takes a BorrowedFd
I don't think there's an obvious way to change PollFd
itself but perhaps poll
could usefully take &mut [Option<PollFd>]
? That would feel like a fairly idiomatic Rust way of saying "there are n entries, but some of them are unused": it would allow PollFd
to maintain its current semantics, but also make poll
code that wants to keep a constant number of entries possible.
I appreciate this is a breaking change, but if it's something that might be welcomed, I'd be happy to raise a PR for it!