use std::cell::RefCell; use std::rc::Weak; use syscall::error::Result; use syscall::flag::EventFlags; use crate::pty::Pty; pub trait Resource { fn pty(&self) -> Weak>; fn flags(&self) -> usize; fn path(&mut self, buf: &mut [u8]) -> Result; fn read(&mut self, buf: &mut [u8]) -> Result; fn write(&mut self, buf: &[u8]) -> Result; fn sync(&mut self) -> Result<()>; fn fcntl(&mut self, cmd: usize, arg: usize) -> Result; fn fevent(&mut self) -> Result; fn events(&mut self) -> EventFlags; fn timeout(&self, _count: u64) { // Handled only by PTY control term } }