LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 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 "os_GOOS.h" | 7 #include "os_GOOS.h" |
8 #include "signal_unix.h" | 8 #include "signal_unix.h" |
9 #include "stack.h" | 9 #include "stack.h" |
10 | 10 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 runtime·write(2, badcallback, sizeof badcallback - 1); | 245 runtime·write(2, badcallback, sizeof badcallback - 1); |
246 } | 246 } |
247 | 247 |
248 static int8 badsignal[] = "runtime: signal received on thread not created by Go:
"; | 248 static int8 badsignal[] = "runtime: signal received on thread not created by Go:
"; |
249 | 249 |
250 // This runs on a foreign stack, without an m or a g. No stack split. | 250 // This runs on a foreign stack, without an m or a g. No stack split. |
251 #pragma textflag 7 | 251 #pragma textflag 7 |
252 void | 252 void |
253 runtime·badsignal(int32 sig) | 253 runtime·badsignal(int32 sig) |
254 { | 254 { |
| 255 int32 len; |
| 256 |
255 if (sig == SIGPROF) { | 257 if (sig == SIGPROF) { |
256 return; // Ignore SIGPROFs intended for a non-Go thread. | 258 return; // Ignore SIGPROFs intended for a non-Go thread. |
257 } | 259 } |
258 runtime·write(2, badsignal, sizeof badsignal - 1); | 260 runtime·write(2, badsignal, sizeof badsignal - 1); |
259 if (0 <= sig && sig < NSIG) { | 261 if (0 <= sig && sig < NSIG) { |
260 » » // Call runtime·findnull dynamically to circumvent static stack
size check. | 262 » » // Can't call findnull() because it will split stack. |
261 » » static int32 (*findnull)(byte*) = runtime·findnull; | 263 » » for(len = 0; runtime·sigtab[sig].name[len]; len++) {} |
262 » » runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runti
me·sigtab[sig].name)); | 264 » » runtime·write(2, runtime·sigtab[sig].name, len); |
263 } | 265 } |
264 runtime·write(2, "\n", 1); | 266 runtime·write(2, "\n", 1); |
265 runtime·exit(1); | 267 runtime·exit(1); |
266 } | 268 } |
267 | 269 |
268 extern void runtime·sigtramp(void); | 270 extern void runtime·sigtramp(void); |
269 | 271 |
270 typedef struct sigaction { | 272 typedef struct sigaction { |
271 union { | 273 union { |
272 void (*__sa_handler)(int32); | 274 void (*__sa_handler)(int32); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 { | 314 { |
313 StackT st; | 315 StackT st; |
314 | 316 |
315 st.ss_sp = (void*)p; | 317 st.ss_sp = (void*)p; |
316 st.ss_size = n; | 318 st.ss_size = n; |
317 st.ss_flags = 0; | 319 st.ss_flags = 0; |
318 if(p == nil) | 320 if(p == nil) |
319 st.ss_flags = SS_DISABLE; | 321 st.ss_flags = SS_DISABLE; |
320 runtime·sigaltstack(&st, nil); | 322 runtime·sigaltstack(&st, nil); |
321 } | 323 } |
LEFT | RIGHT |