Add sys_dup && support input/output redirection in user_shell

This commit is contained in:
Yifan Wu 2021-02-27 22:27:08 +08:00
parent ff685b86c8
commit 685ca2c1ea
6 changed files with 93 additions and 13 deletions

View file

@ -1,3 +1,4 @@
const SYSCALL_DUP: usize = 24;
const SYSCALL_OPEN: usize = 56;
const SYSCALL_CLOSE: usize = 57;
const SYSCALL_PIPE: usize = 59;
@ -19,6 +20,7 @@ use process::*;
pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize {
match syscall_id {
SYSCALL_DUP=> sys_dup(args[0]),
SYSCALL_OPEN => sys_open(args[0] as *const u8, args[1] as u32),
SYSCALL_CLOSE => sys_close(args[0]),
SYSCALL_PIPE => sys_pipe(args[0] as *mut usize),