signal.c (297B)
1 #include <signal.h> 2 #include <stddef.h> 3 4 #include <arch/sigaction.h> 5 #include <sys.h> 6 7 #undef signal 8 9 void 10 (*signal(int signum, void (*func)(int)))(int) 11 { 12 struct sigaction osa, sa = { 13 .sa_handler = func, 14 }; 15 16 if (_sigaction(signum, &sa, &osa) < 0) 17 return SIG_ERR; 18 19 return osa.sa_handler; 20 }