From: Ian Lance Taylor Date: Mon, 26 Sep 2016 18:35:55 +0000 (-0700) Subject: runtime: unify Unix implementations of unminit X-Git-Tag: go1.8beta1~1158 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e2e11f02a4627e4090083d433e6c66602b514ab7;p=gostls13.git runtime: unify Unix implementations of unminit Change-Id: I2cbb13eb85876ad05a52cbd498a9b86e7a28899c Reviewed-on: https://go-review.googlesource.com/29772 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/runtime/os3_solaris.go b/src/runtime/os3_solaris.go index 715fb60c96..144d9cdc1f 100644 --- a/src/runtime/os3_solaris.go +++ b/src/runtime/os3_solaris.go @@ -214,9 +214,7 @@ func minit() { // Called from dropm to undo the effect of an minit. func unminit() { - if getg().m.newSigstack { - signalstack(nil) - } + unminitSignals() } func memlimit() uintptr { diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index 2ac57d3753..5061dde1c5 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -188,9 +188,7 @@ func minit() { // Called from dropm to undo the effect of an minit. //go:nosplit func unminit() { - if getg().m.newSigstack { - signalstack(nil) - } + unminitSignals() } // Mach IPC, to get at semaphores diff --git a/src/runtime/os_dragonfly.go b/src/runtime/os_dragonfly.go index f55b93e67e..df73346a18 100644 --- a/src/runtime/os_dragonfly.go +++ b/src/runtime/os_dragonfly.go @@ -190,9 +190,7 @@ func minit() { // Called from dropm to undo the effect of an minit. //go:nosplit func unminit() { - if getg().m.newSigstack { - signalstack(nil) - } + unminitSignals() } func memlimit() uintptr { diff --git a/src/runtime/os_freebsd.go b/src/runtime/os_freebsd.go index 7c533d4f34..2fc020e528 100644 --- a/src/runtime/os_freebsd.go +++ b/src/runtime/os_freebsd.go @@ -180,9 +180,7 @@ func minit() { // Called from dropm to undo the effect of an minit. //go:nosplit func unminit() { - if getg().m.newSigstack { - signalstack(nil) - } + unminitSignals() } func memlimit() uintptr { diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 92c3db8616..52b6b63868 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -266,9 +266,7 @@ func minit() { // Called from dropm to undo the effect of an minit. //go:nosplit func unminit() { - if getg().m.newSigstack { - signalstack(nil) - } + unminitSignals() } func memlimit() uintptr { diff --git a/src/runtime/os_netbsd.go b/src/runtime/os_netbsd.go index 27c1932fd4..e9c0490455 100644 --- a/src/runtime/os_netbsd.go +++ b/src/runtime/os_netbsd.go @@ -244,9 +244,7 @@ func minit() { // Called from dropm to undo the effect of an minit. //go:nosplit func unminit() { - if getg().m.newSigstack { - signalstack(nil) - } + unminitSignals() } func memlimit() uintptr { diff --git a/src/runtime/os_openbsd.go b/src/runtime/os_openbsd.go index b16b524ab9..d6db2518f3 100644 --- a/src/runtime/os_openbsd.go +++ b/src/runtime/os_openbsd.go @@ -223,9 +223,7 @@ func minit() { // Called from dropm to undo the effect of an minit. //go:nosplit func unminit() { - if getg().m.newSigstack { - signalstack(nil) - } + unminitSignals() } func memlimit() uintptr { diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 3e7c49934b..3a26245221 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -619,6 +619,15 @@ func minitSignalMask() { sigprocmask(_SIG_SETMASK, &nmask, nil) } +// unminitSignals is called from dropm, via unminit, to undo the +// effect of calling minit on a non-Go thread. +//go:nosplit +func unminitSignals() { + if getg().m.newSigstack { + signalstack(nil) + } +} + // setGsignalStack sets the gsignal stack of the current m to an // alternate signal stack returned from the sigaltstack system call. // This is used when handling a signal if non-Go code has set the