mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-21 22:43:23 +00:00
Patch add abort func (#120)
* 对于除了sigkill以外的信号,也加入队列 * bugfix:libc中,注册信号处理函数时,总是注册sigkill的问题 * 增加getpid系统调用 * 增加了raise、kill、abort
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
#include <libc/src/unistd.h>
|
||||
#include <libc/src/stdlib.h>
|
||||
#include <libc/src/ctype.h>
|
||||
#include <libc/src/stdlib.h>
|
||||
#include <libc/src/unistd.h>
|
||||
#include <libsystem/syscall.h>
|
||||
#include <libc/src/include/signal.h>
|
||||
|
||||
int abs(int i)
|
||||
{
|
||||
@ -54,4 +55,15 @@ int atoi(const char *str)
|
||||
void exit(int status)
|
||||
{
|
||||
syscall_invoke(SYS_EXIT, status, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 通过发送SIGABRT,从而退出当前进程
|
||||
*
|
||||
*/
|
||||
void abort()
|
||||
{
|
||||
// step1:设置SIGABRT的处理函数为SIG_DFL
|
||||
signal(SIGABRT, SIG_DFL);
|
||||
raise(SIGABRT);
|
||||
}
|
Reference in New Issue
Block a user