mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-02 12:11:40 +00:00
sys: impl AsFd for PTY
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
34688a6d74
commit
cfa77e0e88
@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! see [PTY](struct.PTY.html) for an example on how to use it
|
||||
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
|
||||
|
||||
use nix::fcntl::OFlag;
|
||||
use nix::pty::{grantpt, posix_openpt, ptsname_r, unlockpt, PtyMaster};
|
||||
@ -125,3 +125,9 @@ impl AsRawFd for PTY {
|
||||
self.primary.as_raw_fd()
|
||||
}
|
||||
}
|
||||
|
||||
impl AsFd for PTY {
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user