Patch add abort func (#120)

* 对于除了sigkill以外的信号,也加入队列

* bugfix:libc中,注册信号处理函数时,总是注册sigkill的问题

* 增加getpid系统调用

* 增加了raise、kill、abort
This commit is contained in:
login
2022-12-19 15:03:44 +08:00
committed by GitHub
parent 47f0d12a1f
commit c588d6f77f
13 changed files with 155 additions and 52 deletions

View File

@ -1,10 +1,10 @@
#include <libc/src/errno.h>
#include <libc/src/fcntl.h>
#include <libc/src/stddef.h>
#include <libc/src/stdio.h>
#include <libc/src/string.h>
#include <libc/src/unistd.h>
#include <libsystem/syscall.h>
#include <libc/src/errno.h>
#include <libc/src/stdio.h>
#include <libc/src/stddef.h>
#include <libc/src/string.h>
#include <libc/src/fcntl.h>
/**
* @brief 关闭文件接口
@ -163,11 +163,11 @@ int rmdir(const char *path)
/**
* @brief 删除文件
*
*
* @param path 绝对路径
* @return int
* @return int
*/
int rm(const char * path)
int rm(const char *path)
{
return syscall_invoke(SYS_UNLINK_AT, 0, (uint64_t)path, 0, 0, 0, 0, 0, 0);
}
@ -193,4 +193,14 @@ void swab(void *restrict src, void *restrict dest, ssize_t nbytes)
_src += transfer;
_dest += transfer;
}
}
/**
* @brief 获取当前进程的pid进程标识符
*
* @return pid_t 当前进程的pid
*/
pid_t getpid(void)
{
syscall_invoke(SYS_GETPID, 0, 0, 0, 0, 0, 0, 0, 0);
}