blob: 96c9983b1de84a1438c314b5c7d4d5c8b1560411 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
*
* Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
*/
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <sys/syscall.h>
#include <bits/kernel_sigaction.h>
/*
* Default sigretrun stub if user doesn't specify SA_RESTORER
*/
static void __default_rt_sa_restorer(void)
{
INTERNAL_SYSCALL_NCS(__NR_rt_sigreturn, , 0);
}
#define SA_RESTORER 0x04000000
/* If @act is not NULL, change the action for @sig to @act.
If @oact is not NULL, put the old action for @sig in @oact. */
int
__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
struct sigaction kact;
/*
* SA_RESTORER is only relevant for act != NULL case
* (!act means caller only wants to know @oact)
*/
if (act && !(act->sa_flags & SA_RESTORER)) {
kact.sa_restorer = __default_rt_sa_restorer;
kact.sa_flags = act->sa_flags | SA_RESTORER;
kact.sa_handler = act->sa_handler;
kact.sa_mask = act->sa_mask;
act = &kact;
}
return __syscall_rt_sigaction(sig, act, oact, sizeof(act->sa_mask));
}
#ifndef LIBC_SIGACTION
# ifndef __UCLIBC_HAS_THREADS__
strong_alias(__libc_sigaction,sigaction)
libc_hidden_def(sigaction)
# else
weak_alias(__libc_sigaction,sigaction)
libc_hidden_weak(sigaction)
# endif
#endif
|