aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2015-12-18 15:29:51 -0800
committerIan Lance Taylor <iant@golang.org>2016-01-05 00:25:50 +0000
commita7d2b4d7cef3bf3107c6cf9725cd1c6151cf18d4 (patch)
treeadc9e286d8416963832e5e408ef223df03a63186 /src/runtime
parent6c8a141a6d53285acc876aacfa0a9c4edb563b6c (diff)
downloadgo-a7d2b4d7cef3bf3107c6cf9725cd1c6151cf18d4.tar.xz
runtime: disable a signal by restoring the original disposition
Fixes #13034. Fixes #13042. Update #9896. Change-Id: I189f381090223dd07086848aac2d69d2c00d80c4 Reviewed-on: https://go-review.googlesource.com/18062 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/runtime2.go1
-rw-r--r--src/runtime/signal1_unix.go13
2 files changed, 3 insertions, 11 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 9549d1f531..c357f6e6d5 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -482,7 +482,6 @@ const (
_SigPanic // if the signal is from the kernel, panic
_SigDefault // if the signal isn't explicitly requested, don't monitor it
_SigHandling // our signal handler is registered
- _SigIgnored // the signal was ignored before we registered for it
_SigGoExit // cause all runtime procs to exit (only used on Plan 9).
_SigSetStack // add SA_ONSTACK to libc handler
_SigUnblock // unblocked in minit
diff --git a/src/runtime/signal1_unix.go b/src/runtime/signal1_unix.go
index 3bb3ed8312..468d6f6946 100644
--- a/src/runtime/signal1_unix.go
+++ b/src/runtime/signal1_unix.go
@@ -49,13 +49,13 @@ func initsig() {
continue
}
fwdSig[i] = getsig(i)
+
// For some signals, we respect an inherited SIG_IGN handler
// rather than insist on installing our own default handler.
// Even these signals can be fetched using the os/signal package.
switch i {
case _SIGHUP, _SIGINT:
- if getsig(i) == _SIG_IGN {
- t.flags = _SigNotify | _SigIgnored
+ if fwdSig[i] == _SIG_IGN {
continue
}
}
@@ -90,9 +90,6 @@ func sigenable(sig uint32) {
<-maskUpdatedChan
if t.flags&_SigHandling == 0 {
t.flags |= _SigHandling
- if getsig(int32(sig)) == _SIG_IGN {
- t.flags |= _SigIgnored
- }
setsig(int32(sig), funcPC(sighandler), true)
}
}
@@ -110,11 +107,7 @@ func sigdisable(sig uint32) {
<-maskUpdatedChan
if t.flags&_SigHandling != 0 {
t.flags &^= _SigHandling
- if t.flags&_SigIgnored != 0 {
- setsig(int32(sig), _SIG_IGN, true)
- } else {
- setsig(int32(sig), _SIG_DFL, true)
- }
+ setsig(int32(sig), fwdSig[sig], true)
}
}
}