Add sys_dup && support input/output redirection in user_shell
This commit is contained in:
parent
ff685b86c8
commit
685ca2c1ea
6 changed files with 93 additions and 13 deletions
|
@ -1,3 +1,4 @@
|
|||
const SYSCALL_DUP: usize = 24;
|
||||
const SYSCALL_OPEN: usize = 56;
|
||||
const SYSCALL_CLOSE: usize = 57;
|
||||
const SYSCALL_PIPE: usize = 59;
|
||||
|
@ -24,6 +25,10 @@ fn syscall(id: usize, args: [usize; 3]) -> isize {
|
|||
ret
|
||||
}
|
||||
|
||||
pub fn sys_dup(fd: usize) -> isize {
|
||||
syscall(SYSCALL_DUP, [fd, 0, 0])
|
||||
}
|
||||
|
||||
pub fn sys_open(path: &str, flags: u32) -> isize {
|
||||
syscall(SYSCALL_OPEN, [path.as_ptr() as usize, flags as usize, 0])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue