Skip to content

Commit

Permalink
Adds OwnedFd::as_raw_fd
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon committed Nov 3, 2024
1 parent 32bf2a2 commit 45a9cf4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/fd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ pub struct OwnedFd<K: Kernel> {
phantom: PhantomData<*const ()>, // For !Send.
}

impl<K: Kernel> OwnedFd<K> {
pub fn as_raw_fd(&self) -> c_int {
self.fd
}
}

impl<K: Kernel> Drop for OwnedFd<K> {
fn drop(&mut self) {
// This drop must be called from the same process as the one that created the FD.
Expand Down

0 comments on commit 45a9cf4

Please sign in to comment.