ref: 5310badb8f39560835f0db678d6784217c92766f
dir: /lib/c/target/posix/signal.c/
#include <stddef.h> #include <signal.h> #include <sys.h> #include "../../syscall.h" #undef signal void (*signal(int signum, void (*func)(int)))(int) { struct sigaction sa = { .sa_handler = func, }; if (_sigaction(signum, &sa, &sa) < 0) return SIG_ERR; return sa.sa_handler; }