diff --git a/src/main.rs b/src/main.rs index 2a982fac3d..6383797016 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,9 +9,9 @@ use std::io::{Read, Write}; use std::rc::{Rc, Weak}; use std::str; -use syscall::data::Packet; +use syscall::data::{Packet, Stat}; use syscall::error::{Error, Result, EBADF, EINVAL, ENOENT, EPIPE, EWOULDBLOCK}; -use syscall::flag::{F_GETFL, F_SETFL, O_ACCMODE, O_NONBLOCK}; +use syscall::flag::{F_GETFL, F_SETFL, O_ACCMODE, O_NONBLOCK, MODE_CHR}; use syscall::scheme::SchemeMut; pub struct PtyScheme { @@ -136,6 +136,15 @@ impl SchemeMut for PtyScheme { Err(Error::new(EBADF)) } + fn fstat(&mut self, _id: usize, stat: &mut Stat) -> Result { + *stat = Stat { + st_mode: MODE_CHR | 0o666, + ..Default::default() + }; + + Ok(0) + } + fn fsync(&mut self, id: usize) -> Result { let slave_opt = self.ptys.1.get(&id).map(|pipe| pipe.clone()); if let Some(pipe) = slave_opt {