banan-os/libc/signal.cpp

20 lines
355 B
C++
Raw Normal View History

#include <signal.h>
#include <sys/syscall.h>
#include <unistd.h>
int raise(int sig)
{
// 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;
}