ref: c987c7dcb71bb3fd9d5388f5573209ae63f52f38
dir: /libnpe/sigaction.c/
#include <signal.h> #include <thread.h> /* FIXME this only supports a single handler */ static sa_handler last; static int handler(void*, char *s) { /* kill is kill */ if(strcmp(s, "kill") != 0 && strcmp(s, "threadint") != 0){ fprint(2, "%s: %s\n", threadgetname(), s); last(SIGSEGV); } return 0; } void sigaction(int, struct sigaction *act, struct sigaction *) { if(act != nil && last == nil){ last = act->sa_handler; atnotify(handler, 1); }else if(act == nil){ atnotify(handler, 0); } }