blob: d3894c8c863391a6f115f192036db262ac1bfe6c [file] [log] [blame]
David du Colombiere9c57d82014-11-21 19:39:01 +01001// Copyright 2011 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
5package runtime
6
7type sigTabT struct {
8 flags int
Matthew Dempsky7b362272015-02-13 12:09:12 +09009 name string
David du Colombiere9c57d82014-11-21 19:39:01 +010010}
11
12// Incoming notes are compared against this table using strncmp, so the
13// order matters: longer patterns must appear before their prefixes.
14// There are _SIG constants in os2_plan9.go for the table index of some
15// of these.
16//
17// If you add entries to this table, you must respect the prefix ordering
18// and also update the constant values is os2_plan9.go.
19var sigtable = [...]sigTabT{
20 // Traps that we cannot be recovered.
Matthew Dempsky7b362272015-02-13 12:09:12 +090021 {_SigThrow, "sys: trap: debug exception"},
22 {_SigThrow, "sys: trap: invalid opcode"},
David du Colombiere9c57d82014-11-21 19:39:01 +010023
24 // We can recover from some memory errors in runtime·sigpanic.
Richard Millerd1454562016-01-27 18:43:36 +000025 {_SigPanic, "sys: trap: fault read"}, // SIGRFAULT
26 {_SigPanic, "sys: trap: fault write"}, // SIGWFAULT
David du Colombiere9c57d82014-11-21 19:39:01 +010027
28 // We can also recover from math errors.
Matthew Dempsky7b362272015-02-13 12:09:12 +090029 {_SigPanic, "sys: trap: divide error"}, // SIGINTDIV
30 {_SigPanic, "sys: fp:"}, // SIGFLOAT
David du Colombiere9c57d82014-11-21 19:39:01 +010031
32 // All other traps are normally handled as if they were marked SigThrow.
33 // We mark them SigPanic here so that debug.SetPanicOnFault will work.
Matthew Dempsky7b362272015-02-13 12:09:12 +090034 {_SigPanic, "sys: trap:"}, // SIGTRAP
David du Colombiere9c57d82014-11-21 19:39:01 +010035
36 // Writes to a closed pipe can be handled if desired, otherwise they're ignored.
Matthew Dempsky7b362272015-02-13 12:09:12 +090037 {_SigNotify, "sys: write on closed pipe"},
David du Colombiere9c57d82014-11-21 19:39:01 +010038
39 // Other system notes are more serious and cannot be recovered.
Matthew Dempsky7b362272015-02-13 12:09:12 +090040 {_SigThrow, "sys:"},
David du Colombiere9c57d82014-11-21 19:39:01 +010041
42 // Issued to all other procs when calling runtime·exit.
Matthew Dempsky7b362272015-02-13 12:09:12 +090043 {_SigGoExit, "go: exit "},
David du Colombiere9c57d82014-11-21 19:39:01 +010044
45 // Kill is sent by external programs to cause an exit.
Matthew Dempsky7b362272015-02-13 12:09:12 +090046 {_SigKill, "kill"},
David du Colombiere9c57d82014-11-21 19:39:01 +010047
48 // Interrupts can be handled if desired, otherwise they cause an exit.
Matthew Dempsky7b362272015-02-13 12:09:12 +090049 {_SigNotify + _SigKill, "interrupt"},
50 {_SigNotify + _SigKill, "hangup"},
David du Colombiere9c57d82014-11-21 19:39:01 +010051
52 // Alarms can be handled if desired, otherwise they're ignored.
Matthew Dempsky7b362272015-02-13 12:09:12 +090053 {_SigNotify, "alarm"},
David du Colombierd093bf42015-10-24 18:14:51 +020054
55 // Aborts can be handled if desired, otherwise they cause a stack trace.
56 {_SigNotify + _SigThrow, "abort"},
David du Colombiere9c57d82014-11-21 19:39:01 +010057}