1 #include <signal.h> 2 #include "syscall.h" 3 signal(int sig,void (* func)(int))4void (*signal(int sig, void (*func)(int)))(int) 5 { 6 struct sigaction sa_old, sa = { .sa_handler = func, .sa_flags = SA_RESTART }; 7 if (__sigaction(sig, &sa, &sa_old) < 0) 8 return SIG_ERR; 9 return sa_old.sa_handler; 10 } 11 12 weak_alias(signal, bsd_signal); 13 weak_alias(signal, __sysv_signal); 14