aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/signal_unix.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2019-10-14 20:10:48 -0400
committerAustin Clements <austin@google.com>2019-10-26 02:52:32 +0000
commit8dc1a158e460d7fdaca3c9317405e7c0dca6e443 (patch)
tree753df3de871b49d09fe0eae8ca4f774fe178a59d /src/runtime/signal_unix.go
parent42aab4b0af5e50071fa8901a038bdc6f1f42b2ed (diff)
downloadgo-8dc1a158e460d7fdaca3c9317405e7c0dca6e443.tar.gz
go-8dc1a158e460d7fdaca3c9317405e7c0dca6e443.zip
runtime: add test for signalM
For #10958, #24543. Change-Id: Ib009a83fe02bc623894f4908fe8f6b266382ba95 Reviewed-on: https://go-review.googlesource.com/c/go/+/201404 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/signal_unix.go')
-rw-r--r--src/runtime/signal_unix.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go
index cea65282e0..27552c9f33 100644
--- a/src/runtime/signal_unix.go
+++ b/src/runtime/signal_unix.go
@@ -412,10 +412,11 @@ func adjustSignalStack(sig uint32, mp *m, gsigStack *gsignalStack) bool {
// GOTRACEBACK=crash when a signal is received.
var crashing int32
-// testSigtrap is used by the runtime tests. If non-nil, it is called
-// on SIGTRAP. If it returns true, the normal behavior on SIGTRAP is
-// suppressed.
+// testSigtrap and testSigusr1 are used by the runtime tests. If
+// non-nil, it is called on SIGTRAP/SIGUSR1. If it returns true, the
+// normal behavior on this signal is suppressed.
var testSigtrap func(info *siginfo, ctxt *sigctxt, gp *g) bool
+var testSigusr1 func(gp *g) bool
// sighandler is invoked when a signal occurs. The global g will be
// set to a gsignal goroutine and we will be running on the alternate
@@ -441,6 +442,10 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
return
}
+ if sig == _SIGUSR1 && testSigusr1 != nil && testSigusr1(gp) {
+ return
+ }
+
flags := int32(_SigThrow)
if sig < uint32(len(sigtable)) {
flags = sigtable[sig].flags