Add dup,dup2 (#224)

* dup,dup2

* fix: sys_dup2语义与posix不一致的问题

---------

Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
Gou Ngai
2023-04-02 15:43:53 +08:00
committed by GitHub
parent d7b31a969f
commit 2b771e32f5
11 changed files with 166 additions and 39 deletions

View File

@ -400,6 +400,9 @@ uint64_t sys_pipe(struct pt_regs *regs)
extern uint64_t sys_mkdir(struct pt_regs *regs);
extern int sys_dup(int oldfd);
extern int sys_dup2(int oldfd, int newfd);
system_call_t system_call_table[MAX_SYSTEM_CALL_NUM] = {
[0] = system_call_not_exists,
[1] = sys_put_string,
@ -429,5 +432,7 @@ system_call_t system_call_table[MAX_SYSTEM_CALL_NUM] = {
[25] = sys_rt_sigreturn,
[26] = sys_getpid,
[27] = sys_sched,
[28 ... 255] = system_call_not_exists,
[28] = sys_dup,
[29] = sys_dup2,
[30 ... 255] = system_call_not_exists,
};

View File

@ -39,5 +39,7 @@
#define SYS_RT_SIGRETURN 25 // 从信号处理函数返回
#define SYS_GETPID 26 // 获取当前进程的pid进程标识符
#define SYS_SCHED 27 // 让系统立即运行调度器该系统调用不能由运行在Ring3的程序发起
#define SYS_DUP 28
#define SYS_DUP2 29
#define SYS_AHCI_END_REQ 255 // AHCI DMA请求结束end_request的系统调用