6 #include "pthread_impl.h"
8 #include "ksigaction.h"
10 void __restore(), __restore_rt();
12 static pthread_t dummy(void) { return 0; }
13 weak_alias(dummy, __pthread_self_def);
15 static unsigned long handler_set[_NSIG/(8*sizeof(long))];
17 void __get_handler_set(sigset_t *set)
19 memcpy(set, handler_set, sizeof handler_set);
22 int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
24 struct k_sigaction ksa, ksa_old;
25 if (sig >= (unsigned)_NSIG) {
30 if ((uintptr_t)sa->sa_handler > 1UL) {
31 a_or_l(handler_set+(sig-1)/(8*sizeof(long)),
32 1UL<<(sig-1)%(8*sizeof(long)));
35 ksa.handler = sa->sa_handler;
36 ksa.flags = sa->sa_flags | SA_RESTORER;
37 ksa.restorer = (sa->sa_flags & SA_SIGINFO) ? __restore_rt : __restore;
38 memcpy(&ksa.mask, &sa->sa_mask, sizeof ksa.mask);
40 if (syscall(SYS_rt_sigaction, sig, sa?&ksa:0, old?&ksa_old:0, sizeof ksa.mask))
43 old->sa_handler = ksa_old.handler;
44 old->sa_flags = ksa_old.flags;
45 memcpy(&old->sa_mask, &ksa_old.mask, sizeof ksa_old.mask);
50 int __sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
56 return __libc_sigaction(sig, sa, old);
59 weak_alias(__sigaction, sigaction);