OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "defs_GOOS_GOARCH.h" | 6 #include "defs_GOOS_GOARCH.h" |
7 #include "signals_GOOS.h" | 7 #include "signals_GOOS.h" |
8 #include "os_GOOS.h" | 8 #include "os_GOOS.h" |
9 | 9 |
10 extern void runtime·sigtramp(void); | 10 extern void runtime·sigtramp(void); |
11 | 11 |
12 typedef struct sigaction { | 12 typedef struct sigaction { |
13 union { | 13 union { |
14 » » void (*__sa_handler)(int32); | 14 » » void (*_sa_handler)(int32); |
15 » » void (*__sa_sigaction)(int32, Siginfo*, void *); | 15 » » void (*_sa_sigaction)(int32, Siginfo*, void *); |
16 » } __sigaction_u;» » /* signal handler */ | 16 » } _sa_u;» » » /* signal handler */ |
17 » uint32» sa_mask;» » /* signal mask to apply */ | 17 » uint32» sa_mask[4];» » /* signal mask to apply */ |
18 int32 sa_flags; /* see signal options below */ | 18 int32 sa_flags; /* see signal options below */ |
19 } Sigaction; | 19 } Sigaction; |
20 | 20 |
21 void | 21 void |
22 runtime·dumpregs(Sigcontext *r) | 22 runtime·dumpregs(Sigcontext *r) |
23 { | 23 { |
24 runtime·printf("eax %x\n", r->sc_eax); | 24 runtime·printf("eax %x\n", r->sc_eax); |
25 runtime·printf("ebx %x\n", r->sc_ebx); | 25 runtime·printf("ebx %x\n", r->sc_ebx); |
26 runtime·printf("ecx %x\n", r->sc_ecx); | 26 runtime·printf("ecx %x\n", r->sc_ecx); |
27 runtime·printf("edx %x\n", r->sc_edx); | 27 runtime·printf("edx %x\n", r->sc_edx); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 void | 118 void |
119 runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart) | 119 runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart) |
120 { | 120 { |
121 Sigaction sa; | 121 Sigaction sa; |
122 | 122 |
123 runtime·memclr((byte*)&sa, sizeof sa); | 123 runtime·memclr((byte*)&sa, sizeof sa); |
124 sa.sa_flags = SA_SIGINFO|SA_ONSTACK; | 124 sa.sa_flags = SA_SIGINFO|SA_ONSTACK; |
125 if(restart) | 125 if(restart) |
126 sa.sa_flags |= SA_RESTART; | 126 sa.sa_flags |= SA_RESTART; |
127 » sa.sa_mask = ~0ULL; | 127 » sa.sa_mask[0] = ~0U; |
| 128 » sa.sa_mask[1] = ~0U; |
| 129 » sa.sa_mask[2] = ~0U; |
| 130 » sa.sa_mask[3] = ~0U; |
128 if (fn == runtime·sighandler) | 131 if (fn == runtime·sighandler) |
129 fn = (void*)runtime·sigtramp; | 132 fn = (void*)runtime·sigtramp; |
130 » sa.__sigaction_u.__sa_sigaction = (void*)fn; | 133 » sa._sa_u._sa_sigaction = (void*)fn; |
131 runtime·sigaction(i, &sa, nil); | 134 runtime·sigaction(i, &sa, nil); |
132 } | 135 } |
OLD | NEW |