Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose RawFd in impl PollFd #1146

Closed
mlang opened this issue Oct 30, 2019 · 0 comments · Fixed by #1516
Closed

Expose RawFd in impl PollFd #1146

mlang opened this issue Oct 30, 2019 · 0 comments · Fixed by #1516

Comments

@mlang
Copy link

mlang commented Oct 30, 2019

nix::poll::PollFd currently only exposes revents(). However, there is no way to get to the actual fd because libc::pollfd is private. I think a function like:

impl PollFd {
pub fn fd(&self) -> RawFd { self.pollfd.fd }
}
or similar would be useful.
As it stands, I dont really know how to figure out which event belongs to which fd.

bors bot added a commit that referenced this issue Sep 7, 2021
1516: Implement AsRawFd for PollFd r=asomers a=cemeyer

Implement the trait on PollFd, providing an `as_raw_fd()` accessor to
get the RawFd associated with the PollFd.

Subsumes #1147, #1286.  Closes #1146.

Test: `cargo test --test test test_pollfd_fd`

Co-authored-by: Conrad Meyer <cem@FreeBSD.org>
@bors bors bot closed this as completed in b0b7beb Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant