2018-11-05 16:40:48 +01:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <signal.h>
|
2018-10-31 01:06:57 +01:00
|
|
|
#include <Kernel/Syscall.h>
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
int kill(pid_t pid, int sig)
|
|
|
|
{
|
|
|
|
int rc = Syscall::invoke(Syscall::PosixKill, (dword)pid, (dword)sig);
|
|
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
|
|
}
|
|
|
|
|
2018-11-05 18:16:00 +01:00
|
|
|
sighandler_t signal(int signum, sighandler_t handler)
|
|
|
|
{
|
|
|
|
sighandler_t old_handler = (sighandler_t)Syscall::invoke(Syscall::PosixSignal, (dword)signum, (dword)handler);
|
|
|
|
if (old_handler == SIG_ERR) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return SIG_ERR;
|
|
|
|
}
|
|
|
|
errno = 0;
|
|
|
|
return old_handler;
|
|
|
|
}
|
|
|
|
|
2018-10-31 01:06:57 +01:00
|
|
|
}
|
|
|
|
|