Skip to content

Implement From<EventFd> for OwnedFd - #8

Open
nekto0n wants to merge 1 commit into
polachok:masterfrom
nekto0n:nekto0n/into-owned-fd
Open

Implement From<EventFd> for OwnedFd#8
nekto0n wants to merge 1 commit into
polachok:masterfrom
nekto0n:nekto0n/into-owned-fd

Conversation

@nekto0n

@nekto0n nekto0n commented Jan 13, 2026

Copy link
Copy Markdown

User story

In some cases a user might need to send an event FD to a remote side via UNIX socket (in our case - over a DBus connection) and currently there's no way to do that with event FD except for .duping to get an owned FD and then dropping the original.

Solution

Pretty much explained in the code comments:

  • we need to get the Inner first to deregister the FD from the tokio event loop
  • then do a trick with std::mem::forget to avoid closing the FD

Tests

Tested that it works in my project 🤷

@nekto0n

nekto0n commented Feb 18, 2026

Copy link
Copy Markdown
Author

@polachok, hi! Could you please take a look?

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.

1 participant