]>
sourceware.org Git - glibc.git/blob - sysdeps/unix/sysv/linux/mips/sigaction.c
1 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <http://www.gnu.org/licenses/>. */
24 #include <sys/syscall.h>
28 /* The difference here is that the sigaction structure used in the
29 kernel is not the same as we use in the libc. Therefore we must
31 #include <kernel_sigaction.h>
33 #if _MIPS_SIM != _ABIO32
35 # ifdef __NR_rt_sigreturn
36 static void restore_rt (void) asm ("__restore_rt");
38 # ifdef __NR_sigreturn
39 static void restore (void) asm ("__restore");
43 /* If ACT is not NULL, change the action for SIG to *ACT.
44 If OACT is not NULL, put the old action for SIG in *OACT. */
46 __libc_sigaction (int sig
, const struct sigaction
*act
, struct sigaction
*oact
)
50 struct kernel_sigaction kact
, koact
;
54 kact
.k_sa_handler
= act
->sa_handler
;
55 memcpy (&kact
.sa_mask
, &act
->sa_mask
, sizeof (kernel_sigset_t
));
56 kact
.sa_flags
= act
->sa_flags
;
57 #ifdef HAVE_SA_RESTORER
58 # if _MIPS_SIM == _ABIO32
59 kact
.sa_restorer
= act
->sa_restorer
;
61 kact
.sa_restorer
= &restore_rt
;
66 /* XXX The size argument hopefully will have to be changed to the
67 real size of the user-level sigset_t. */
68 result
= INLINE_SYSCALL (rt_sigaction
, 4, sig
,
71 sizeof (kernel_sigset_t
));
73 if (oact
&& result
>= 0)
75 oact
->sa_handler
= koact
.k_sa_handler
;
76 memcpy (&oact
->sa_mask
, &koact
.sa_mask
,
77 sizeof (kernel_sigset_t
));
78 oact
->sa_flags
= koact
.sa_flags
;
79 #ifdef HAVE_SA_RESTORER
80 oact
->sa_restorer
= koact
.sa_restorer
;
85 libc_hidden_def (__libc_sigaction
)
87 #include <nptl/sigaction.c>
90 /* NOTE: Please think twice before making any changes to the bits of
91 code below. GDB needs some intimate knowledge about it to
92 recognize them as signal trampolines, and make backtraces through
93 signal handlers work right. Important are both the names
94 (__restore_rt) and the exact instruction sequence.
95 If you ever feel the need to make any changes, please notify the
96 appropriate GDB maintainer. */
98 #define RESTORE(name, syscall) RESTORE2 (name, syscall)
99 #define RESTORE2(name, syscall) \
104 " li $2, " #syscall "\n" \
108 /* The return code for realtime-signals. */
109 #if _MIPS_SIM != _ABIO32
110 # ifdef __NR_rt_sigreturn
111 RESTORE (restore_rt
, __NR_rt_sigreturn
)
113 # ifdef __NR_sigreturn
114 RESTORE (restore
, __NR_sigreturn
)
This page took 0.041079 seconds and 5 git commands to generate.