1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package runtime 6 7 import "unsafe" 8 9 type sigTabT struct { 10 flags int32 11 name string 12 } 13 14 var sigtable = [...]sigTabT{ 15 /* 0 */ {0, "SIGNONE: no trap"}, 16 /* 1 */ {_SigNotify + _SigKill, "SIGHUP: terminal line hangup"}, 17 /* 2 */ {_SigNotify + _SigKill, "SIGINT: interrupt"}, 18 /* 3 */ {_SigNotify + _SigThrow, "SIGQUIT: quit"}, 19 /* 4 */ {_SigThrow + _SigUnblock, "SIGILL: illegal instruction"}, 20 /* 5 */ {_SigThrow + _SigUnblock, "SIGTRAP: trace trap"}, 21 /* 6 */ {_SigNotify + _SigThrow, "SIGABRT: abort"}, 22 /* 7 */ {_SigPanic + _SigUnblock, "SIGBUS: bus error"}, 23 /* 8 */ {_SigPanic + _SigUnblock, "SIGFPE: floating-point exception"}, 24 /* 9 */ {0, "SIGKILL: kill"}, 25 /* 10 */ {_SigNotify, "SIGUSR1: user-defined signal 1"}, 26 /* 11 */ {_SigPanic + _SigUnblock, "SIGSEGV: segmentation violation"}, 27 /* 12 */ {_SigNotify, "SIGUSR2: user-defined signal 2"}, 28 /* 13 */ {_SigNotify, "SIGPIPE: write to broken pipe"}, 29 /* 14 */ {_SigNotify, "SIGALRM: alarm clock"}, 30 /* 15 */ {_SigNotify + _SigKill, "SIGTERM: termination"}, 31 /* 16 */ {_SigThrow + _SigUnblock, "SIGSTKFLT: stack fault"}, 32 /* 17 */ {_SigNotify + _SigUnblock, "SIGCHLD: child status has changed"}, 33 /* 18 */ {0, "SIGCONT: continue"}, 34 /* 19 */ {0, "SIGSTOP: stop, unblockable"}, 35 /* 20 */ {_SigNotify + _SigDefault, "SIGTSTP: keyboard stop"}, 36 /* 21 */ {_SigNotify + _SigDefault, "SIGTTIN: background read from tty"}, 37 /* 22 */ {_SigNotify + _SigDefault, "SIGTTOU: background write to tty"}, 38 /* 23 */ {_SigNotify, "SIGURG: urgent condition on socket"}, 39 /* 24 */ {_SigNotify, "SIGXCPU: cpu limit exceeded"}, 40 /* 25 */ {_SigNotify, "SIGXFSZ: file size limit exceeded"}, 41 /* 26 */ {_SigNotify, "SIGVTALRM: virtual alarm clock"}, 42 /* 27 */ {_SigNotify + _SigUnblock, "SIGPROF: profiling alarm clock"}, 43 /* 28 */ {_SigNotify, "SIGWINCH: window size change"}, 44 /* 29 */ {_SigNotify, "SIGIO: i/o now possible"}, 45 /* 30 */ {_SigNotify, "SIGPWR: power failure restart"}, 46 /* 31 */ {_SigNotify, "SIGSYS: bad system call"}, 47 /* 32 */ {_SigSetStack, "signal 32"}, /* SIGCANCEL; see issue 6997 */ 48 /* 33 */ {_SigSetStack, "signal 33"}, /* SIGSETXID; see issue 3871, 9400 */ 49 /* 34 */ {_SigNotify, "signal 34"}, 50 /* 35 */ {_SigNotify, "signal 35"}, 51 /* 36 */ {_SigNotify, "signal 36"}, 52 /* 37 */ {_SigNotify, "signal 37"}, 53 /* 38 */ {_SigNotify, "signal 38"}, 54 /* 39 */ {_SigNotify, "signal 39"}, 55 /* 40 */ {_SigNotify, "signal 40"}, 56 /* 41 */ {_SigNotify, "signal 41"}, 57 /* 42 */ {_SigNotify, "signal 42"}, 58 /* 43 */ {_SigNotify, "signal 43"}, 59 /* 44 */ {_SigNotify, "signal 44"}, 60 /* 45 */ {_SigNotify, "signal 45"}, 61 /* 46 */ {_SigNotify, "signal 46"}, 62 /* 47 */ {_SigNotify, "signal 47"}, 63 /* 48 */ {_SigNotify, "signal 48"}, 64 /* 49 */ {_SigNotify, "signal 49"}, 65 /* 50 */ {_SigNotify, "signal 50"}, 66 /* 51 */ {_SigNotify, "signal 51"}, 67 /* 52 */ {_SigNotify, "signal 52"}, 68 /* 53 */ {_SigNotify, "signal 53"}, 69 /* 54 */ {_SigNotify, "signal 54"}, 70 /* 55 */ {_SigNotify, "signal 55"}, 71 /* 56 */ {_SigNotify, "signal 56"}, 72 /* 57 */ {_SigNotify, "signal 57"}, 73 /* 58 */ {_SigNotify, "signal 58"}, 74 /* 59 */ {_SigNotify, "signal 59"}, 75 /* 60 */ {_SigNotify, "signal 60"}, 76 /* 61 */ {_SigNotify, "signal 61"}, 77 /* 62 */ {_SigNotify, "signal 62"}, 78 /* 63 */ {_SigNotify, "signal 63"}, 79 /* 64 */ {_SigNotify, "signal 64"}, 80 } 81 82 // Continuation of the (assembly) sigtramp() logic. 83 //go:nosplit 84 func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { 85 if sigfwdgo(sig, info, ctx) { 86 return 87 } 88 g := getg() 89 if g == nil { 90 badsignal(uintptr(sig)) 91 return 92 } 93 setg(g.m.gsignal) 94 sighandler(sig, info, ctx, g) 95 setg(g) 96 } 97