Test for BadFile
This commit is contained in:
parent
d97e2e4b4a
commit
8a6d9b8c9d
2 changed files with 19 additions and 5 deletions
|
@ -5,7 +5,12 @@ use super::{Error, Result};
|
|||
/// Read syscall
|
||||
pub fn read(fd: usize, buf: &mut [u8]) -> Result<usize> {
|
||||
println!("Read {}: {}", fd, buf.len());
|
||||
Ok(0)
|
||||
if let Some(file) = unsafe { &mut ::context::CONTEXT }.files.get(fd) {
|
||||
println!("{:?}", file);
|
||||
Ok(0)
|
||||
} else {
|
||||
Err(Error::BadFile)
|
||||
}
|
||||
}
|
||||
|
||||
/// Write syscall
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue