commit 0329ac741bc4f2e5cb1f8926697b4160de51f068 parent 376cf96c81cdb916ef3ab2f7e366fb3e812c0679 Author: Sebastian <sebastian@sebsite.pw> Date: Mon, 8 May 2023 20:44:36 -0400 unix::signal: add resetall Signed-off-by: Sebastian <sebastian@sebsite.pw> Diffstat:
M | unix/signal/+linux.ha | | | 34 | ++++++++++++++++++++++++++++++++++ |
1 file changed, 34 insertions(+), 0 deletions(-)
diff --git a/unix/signal/+linux.ha b/unix/signal/+linux.ha @@ -66,6 +66,40 @@ export fn reset(signum: signal) void = { handle(signum, rt::SIG_DFL); }; +// Unregisters all signal handlers. +export fn resetall() void = { + // SIGKILL and SIGSTOP deliberately omitted; see sigaction(2) + reset(SIGHUP); + reset(SIGINT); + reset(SIGQUIT); + reset(SIGILL); + reset(SIGTRAP); + reset(SIGABRT); + reset(SIGBUS); + reset(SIGFPE); + reset(SIGUSR1); + reset(SIGSEGV); + reset(SIGUSR2); + reset(SIGPIPE); + reset(SIGALRM); + reset(SIGTERM); + reset(SIGCHLD); + reset(SIGCONT); + reset(SIGTSTP); + reset(SIGTTIN); + reset(SIGTTOU); + reset(SIGURG); + reset(SIGXCPU); + reset(SIGXFSZ); + reset(SIGVTALRM); + reset(SIGPROF); + reset(SIGWINCH); + reset(SIGIO); + reset(SIGPOLL); + reset(SIGPWR); + reset(SIGSYS); +}; + // Prevents given signal from arriving to the current process. // One common use case is to ignore SIGCHLD to avoid zombie child processes. export fn ignore(signum: signal) void = {