1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:35:07 +00:00
serenity/LibC/signal.cpp
Andreas Kling 82f84bab11 More random compat hacking towards getting bash to build.
I'm now at the build stage where it complains about a bajillion missing
symbols. This is a good place to be!
2018-11-05 18:21:42 +01:00

26 lines
551 B
C++

#include <unistd.h>
#include <errno.h>
#include <signal.h>
#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);
}
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;
}
}