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 int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
16 struct k_sigaction ksa;
18 if ((uintptr_t)sa->sa_handler > 1UL)
20 ksa.handler = sa->sa_handler;
21 ksa.flags = sa->sa_flags | SA_RESTORER;
22 ksa.restorer = (sa->sa_flags & SA_SIGINFO) ? __restore_rt : __restore;
23 memcpy(&ksa.mask, &sa->sa_mask, sizeof ksa.mask);
25 if (syscall(SYS_rt_sigaction, sig, sa?&ksa:0, old?&ksa:0, sizeof ksa.mask))
28 old->sa_handler = ksa.handler;
29 old->sa_flags = ksa.flags;
30 memcpy(&old->sa_mask, &ksa.mask, sizeof ksa.mask);
35 int __sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
41 return __libc_sigaction(sig, sa, old);
44 weak_alias(__sigaction, sigaction);