5 #include "pthread_impl.h"
7 #include "ksigaction.h"
9 void __restore(), __restore_rt();
11 static pthread_t dummy(void) { return 0; }
12 weak_alias(dummy, __pthread_self_def);
14 static unsigned long handler_set[_NSIG/(8*sizeof(long))];
16 void __get_handler_set(sigset_t *set)
18 memcpy(set, handler_set, sizeof handler_set);
21 int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
23 struct k_sigaction ksa, ksa_old;
24 if (sig >= (unsigned)_NSIG) {
29 if ((uintptr_t)sa->sa_handler > 1UL) {
30 a_or_l(handler_set+(sig-1)/(8*sizeof(long)),
31 1UL<<(sig-1)%(8*sizeof(long)));
34 ksa.handler = sa->sa_handler;
35 ksa.flags = sa->sa_flags | SA_RESTORER;
36 ksa.restorer = (sa->sa_flags & SA_SIGINFO) ? __restore_rt : __restore;
37 memcpy(&ksa.mask, &sa->sa_mask, sizeof ksa.mask);
39 if (syscall(SYS_rt_sigaction, sig, sa?&ksa:0, old?&ksa_old:0, sizeof ksa.mask))
42 old->sa_handler = ksa_old.handler;
43 old->sa_flags = ksa_old.flags;
44 memcpy(&old->sa_mask, &ksa_old.mask, sizeof ksa_old.mask);
49 int __sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
55 return __libc_sigaction(sig, sa, old);
58 weak_alias(__sigaction, sigaction);