Skip to content

Conversation

ChrysoliteAzalea
Copy link
Contributor

Hello everyone! I propose exposing the AsRawFd API for Fanotifystruct.

What does this PR do

This PR forwards the as_raw_fd() on Fanotify instance to the underlying OwnedFd instance. This is necessary to register the struct with Tokio using the AsyncFd generic struct, which allows working with fanotify asynchronously -- instead of blocking the current thread, or manually polling file descriptors, an async function can use the await operator to read events if they are ready, or switch to other task if no events have yet arrived.

Checklist:

  • [yes] I have read CONTRIBUTING.md
  • [yes] I have written necessary tests and rustdoc comments (no rustdoc comments are necessary, as_raw_fd() is already documented by the standard library)
  • [yes] A change log has been added if this PR modifies nix's API

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for your contribution.

@asomers asomers added this pull request to the merge queue Jan 2, 2025
Merged via the queue into nix-rust:master with commit 29bbd8e Jan 2, 2025
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants