Implement fstat() for pipe scheme

This commit is contained in:
Ian Douglas Scott
2017-07-11 21:26:35 -07:00
parent a03457a9eb
commit f81a276536

View File

@@ -6,8 +6,9 @@ use scheme::{AtomicSchemeId, ATOMIC_SCHEMEID_INIT, SchemeId};
use sync::WaitCondition;
use syscall::error::{Error, Result, EAGAIN, EBADF, EINVAL, EPIPE};
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::Scheme;
use syscall::data::Stat;
/// Pipes list
pub static PIPE_SCHEME_ID: AtomicSchemeId = ATOMIC_SCHEMEID_INIT;
@@ -122,6 +123,15 @@ impl Scheme for PipeScheme {
Ok(i)
}
fn fstat(&self, _id: usize, stat: &mut Stat) -> Result<usize> {
*stat = Stat {
st_mode: MODE_CHR | 0o666,
..Default::default()
};
Ok(0)
}
fn fsync(&self, _id: usize) -> Result<usize> {
Ok(0)
}