Simple filetest passed on qemu/k210.

This commit is contained in:
Yifan Wu 2020-12-20 13:52:38 +08:00
parent b68278f22e
commit b121689d08
11 changed files with 159 additions and 24 deletions

View file

@ -10,6 +10,8 @@ mod syscall;
mod lang_items;
extern crate alloc;
#[macro_use]
extern crate bitflags;
use syscall::*;
use buddy_system_allocator::LockedHeap;
@ -42,6 +44,17 @@ fn main() -> i32 {
panic!("Cannot find main!");
}
bitflags! {
pub struct OpenFlags: u32 {
const RDONLY = 0;
const WRONLY = 1 << 0;
const RDWR = 1 << 1;
const CREATE = 1 << 9;
const TRUNC = 1 << 10;
}
}
pub fn open(path: &str, flags: OpenFlags) -> isize { sys_open(path, flags.bits) }
pub fn close(fd: usize) -> isize { sys_close(fd) }
pub fn pipe(pipe_fd: &mut [usize]) -> isize { sys_pipe(pipe_fd) }
pub fn read(fd: usize, buf: &mut [u8]) -> isize { sys_read(fd, buf) }