Skip to content

Commit

Permalink
Merge pull request #3105 from cgwalters/sysroot-borrow-fd
Browse files Browse the repository at this point in the history
sysroot: Add a method to borrow sysroot fd
  • Loading branch information
jmarrero authored Dec 4, 2023
2 parents 09e32d6 + d3190db commit 59b9f9a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rust-bindings/src/sysroot.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::gio;
use crate::Sysroot;
#[cfg(any(feature = "v2017_10", feature = "dox"))]
use std::os::fd::BorrowedFd;
use std::path::PathBuf;

#[derive(Clone, Debug, Default)]
Expand Down Expand Up @@ -62,6 +64,14 @@ impl SysrootBuilder {
}
}

impl Sysroot {
/// Borrow the directory file descriptor for this sysroot.
#[cfg(feature = "v2017_10")]
pub fn dfd_borrow(&self) -> BorrowedFd {
unsafe { BorrowedFd::borrow_raw(self.fd()) }
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 59b9f9a

Please sign in to comment.