_sigaction.c (485B)
1 #include <string.h> 2 3 #include <arch/sigaction.h> 4 #include <sys.h> 5 6 extern void _sigreturn(void); 7 8 int _sigaction(int sig, struct sigaction *sa, struct sigaction *old) 9 { 10 struct sigaction ksa, *p = NULL; 11 12 if (sa) { 13 ksa.sa_handler = sa->sa_handler; 14 ksa.sa_flags = sa->sa_flags | SA_RESTORER; 15 ksa.sa_restorer = _sigreturn; 16 memcpy(&ksa.sa_mask, &sa->sa_mask, sizeof(ksa.sa_mask)); 17 p = &ksa; 18 } 19 20 if (__sigaction(sig, p, old, sizeof(ksa.sa_mask)) < 0) 21 return -1; 22 23 return 0; 24 }