2023-07-21 15:45:02 +03:00
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
int raise(int sig)
|
|
|
|
{
|
2023-12-06 13:00:45 +02:00
|
|
|
// FIXME: won't work after multithreaded
|
|
|
|
return kill(getpid(), sig);
|
2023-07-21 19:27:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int kill(pid_t pid, int sig)
|
|
|
|
{
|
|
|
|
return syscall(SYS_KILL, pid, sig);
|
2023-07-21 20:08:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void (*signal(int sig, void (*func)(int)))(int)
|
|
|
|
{
|
|
|
|
long ret = syscall(SYS_SIGNAL, sig, func);
|
|
|
|
return (void (*)(int))ret;
|
2023-07-21 15:45:02 +03:00
|
|
|
}
|