signal的处理(kill命令)以及一些其他的改进 (#100)

* 将entry.S中冗余的ret_from_syscall代码删除,改为jmp Restore_all

* new: 增加判断pt_regs是否来自用户态的函数

* new: rust的cli和sti封装

* 将原有的判断pt_regs是否来自用户态的代码,统一改为调用user_mode函数

* ffz函数:获取u64中的第一个值为0的bit

* spinlock增加 spinlock irq spin_unlock_irq

* 临时解决显示刷新线程迟迟不运行的问题

* 更改ffi_convert的生命周期标签

* new: 测试signal用的app

* 解决由于编译器优化导致local_irq_restore无法获取到正确的rflags的值的问题

* new: exec命令增加"&"后台运行选项

* procfs->status增加显示preempt和虚拟运行时间

* 更改引用计数的FFIBind2Rust trait中的生命周期标签

* new: signal处理(kill)

* 更正在review中发现的一些细节问题
This commit is contained in:
login
2022-12-08 22:59:51 +08:00
committed by GitHub
parent f8b55f6d3f
commit 1a2eaa402f
30 changed files with 1002 additions and 192 deletions

View File

@ -467,7 +467,7 @@ int shell_cmd_exec(int argc, char **argv)
if (pid == 0)
{
// printf("child proc\n");
// 子进程
int path_len = 0;
char *file_path = get_target_filepath(argv[1], &path_len);
@ -480,10 +480,13 @@ int shell_cmd_exec(int argc, char **argv)
}
else
{
// printf("parent process wait for pid:[ %d ]\n", pid);
waitpid(pid, &retval, 0);
// printf("parent process wait pid [ %d ], exit code=%d\n", pid, retval);
// 如果不指定后台运行,则等待退出
if (strcmp(argv[argc - 1], "&") != 0)
waitpid(pid, &retval, 0);
else{
// 输出子进程的pid
printf("[1] %d\n", pid);
}
free(argv);
}
}
@ -513,8 +516,6 @@ int shell_cmd_kill(int argc, char **argv)
retval = -EINVAL;
goto out;
}
printf("argc = %d, argv[1]=%s\n", argc, argv[1]);
printf("atoi(argv[1])=%d\n", atoi(argv[1]));
retval = syscall_invoke(SYS_KILL, atoi(argv[1]), SIGKILL, 0, 0, 0, 0, 0, 0);
out:;
free(argv);