feat(signal): signal handling and sigset_t

This commit is contained in:
2026-09-05 23:03:41 -04:00
parent 8c0f23fbd0
commit 9ffe86fc55
18 changed files with 1628 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <signal.h>
#include <errno.h>
#include "../internal/syscall.h"
/*
* kill/killpg: process- and process-group-directed signals over SYS_kill.
*
* kill passes its pid straight to the kernel, which interprets it exactly
* as POSIX specifies: pid > 0 is a single process, pid == 0 the caller's
* process group, pid == -1 every process the caller may signal, and
* pid < -1 the process group -pid. killpg(pgrp, sig) is equivalent to
* kill(-pgrp, sig): a negative pgrp is not a valid group id and is
* rejected with EINVAL here (mirroring musl) rather than inverted into a
* positive-pid send by accident.
*/
int
kill(pid_t pid, int sig)
{
return syscall_ret(__syscall2(SYS_kill, (long)pid, sig));
}
int
killpg(pid_t pgrp, int sig)
{
if (pgrp < 0)
{
errno = EINVAL;
return -1;
}
return kill(-pgrp, sig);
}