summaryrefslogtreecommitdiff
path: root/src/runtime/sigpanic_unix.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-11-11 17:05:55 -0500
committerRuss Cox <rsc@golang.org>2014-11-11 17:05:55 -0500
commit9d4310437c64e72f760cf65385cf2a1563d41e9c (patch)
tree52fbd8b9bca8c1e9ecad9349e05848da359a9090 /src/runtime/sigpanic_unix.go
parent4341f082b01ba446d416cb5cbaacc55ff0fefe13 (diff)
downloadgo-9d4310437c64e72f760cf65385cf2a1563d41e9c.tar.gz
[dev.cc] runtime: convert signal handlers from C to Go
This code overused macros and could not be converted automatically. Instead a new sigctxt type had to be defined for each os/arch combination, with a common (implicit) interface used by the arch-specific signal handler code. [This CL is part of the removal of C code from package runtime. See golang.org/s/dev.cc for an overview.] LGTM=r R=r CC=austin, dvyukov, golang-codereviews, iant, khr https://codereview.appspot.com/168500044
Diffstat (limited to 'src/runtime/sigpanic_unix.go')
-rw-r--r--src/runtime/sigpanic_unix.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/runtime/sigpanic_unix.go b/src/runtime/sigpanic_unix.go
index 68079859b..7bf2c1540 100644
--- a/src/runtime/sigpanic_unix.go
+++ b/src/runtime/sigpanic_unix.go
@@ -6,8 +6,6 @@
package runtime
-func signame(int32) *byte
-
func sigpanic() {
g := getg()
if !canpanic(g) {
@@ -36,5 +34,10 @@ func sigpanic() {
}
panicfloat()
}
- panic(errorString(gostringnocopy(signame(g.sig))))
+
+ if g.sig >= uint32(len(sigtable)) {
+ // can't happen: we looked up g.sig in sigtable to decide to call sigpanic
+ gothrow("unexpected signal value")
+ }
+ panic(errorString(sigtable[g.sig].name))
}