diff --git a/kernel/sys/signal.c b/kernel/sys/signal.c index a9bfb80a..281c16f7 100644 --- a/kernel/sys/signal.c +++ b/kernel/sys/signal.c @@ -188,27 +188,27 @@ int send_signal(pid_t process, uint32_t signal, int force_root) { if (!receiver) { /* Invalid pid */ - return 1; + return -ESRCH; } if (!force_root && receiver->user != current_process->user && current_process->user != USER_ROOT_UID) { /* No way in hell. */ - return 1; + return -EPERM; } if (signal > NUMSIGNALS) { /* Invalid signal */ - return 1; + return -EINVAL; } if (receiver->finished) { /* Can't send signals to finished processes */ - return 1; + return -EINVAL; } if (!receiver->signals.functions[signal] && !isdeadly[signal]) { /* If we're blocking a signal and it's not going to kill us, don't deliver it */ - return 1; + return 0; } /* Append signal to list */ diff --git a/libc/signal/kill.c b/libc/signal/kill.c index 0f2e66d0..cd5e4b0e 100644 --- a/libc/signal/kill.c +++ b/libc/signal/kill.c @@ -1,9 +1,10 @@ #include #include +#include DEFN_SYSCALL2(send_signal, 37, uint32_t, uint32_t); int kill(int pid, int sig) { - return syscall_send_signal(pid, sig); + __sets_errno(syscall_send_signal(pid, sig)); }