arc: clone: Simplify CLONE_THREAD detection
[uclibc-ng.git] / libc / sysdeps / linux / arc / sigaction.c
blob67ca38acaccab837bd84ed372c9072fb9b4ce38e
1 /*
2 * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
4 * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
5 */
7 #include <errno.h>
8 #include <signal.h>
9 #include <string.h>
10 #include <sys/syscall.h>
11 #include <bits/kernel_sigaction.h>
14 * Default sigretrun stub if user doesn't specify SA_RESTORER
16 static void attribute_optimize("Os") __attribute_noinline__
17 __default_rt_sa_restorer(void)
19 INTERNAL_SYSCALL_NCS(__NR_rt_sigreturn, , 0);
22 #define SA_RESTORER 0x04000000
24 /* If @act is not NULL, change the action for @sig to @act.
25 If @oact is not NULL, put the old action for @sig in @oact. */
26 int
27 __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
29 struct sigaction kact;
32 * SA_RESTORER is only relevant for act != NULL case
33 * (!act means caller only wants to know @oact)
35 if (act && !(act->sa_flags & SA_RESTORER)) {
36 kact.sa_restorer = __default_rt_sa_restorer;
37 kact.sa_flags = act->sa_flags | SA_RESTORER;
39 kact.sa_handler = act->sa_handler;
40 kact.sa_mask = act->sa_mask;
42 act = &kact;
45 return INLINE_SYSCALL(rt_sigaction, 4,
46 sig, act, oact, sizeof(act->sa_mask));
49 #ifndef LIBC_SIGACTION
50 # ifndef __UCLIBC_HAS_THREADS__
51 strong_alias(__libc_sigaction,sigaction)
52 libc_hidden_def(sigaction)
53 # else
54 weak_alias(__libc_sigaction,sigaction)
55 libc_hidden_weak(sigaction)
56 # endif
57 #endif