Commit 097a581d authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: simplify signalstack by dropping nil as argument

Change the two calls to signalstack(nil) to inline the code
instead (it's two lines).

Change-Id: Ie92a05494f924f279e40ac159f1b677fda18f281
Reviewed-on: https://go-review.googlesource.com/29854
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 60482d8a
...@@ -192,7 +192,8 @@ func newosproc(mp *m, stk unsafe.Pointer) { ...@@ -192,7 +192,8 @@ func newosproc(mp *m, stk unsafe.Pointer) {
// At this point all signals are blocked, so there is no race. // At this point all signals are blocked, so there is no race.
//go:nosplit //go:nosplit
func netbsdMstart() { func netbsdMstart() {
signalstack(nil) st := stackt{ss_flags: _SS_DISABLE}
sigaltstack(&st, nil)
mstart() mstart()
} }
......
...@@ -624,7 +624,8 @@ func minitSignalMask() { ...@@ -624,7 +624,8 @@ func minitSignalMask() {
//go:nosplit //go:nosplit
func unminitSignals() { func unminitSignals() {
if getg().m.newSigstack { if getg().m.newSigstack {
signalstack(nil) st := stackt{ss_flags: _SS_DISABLE}
sigaltstack(&st, nil)
} }
} }
...@@ -645,17 +646,10 @@ func setGsignalStack(st *stackt) { ...@@ -645,17 +646,10 @@ func setGsignalStack(st *stackt) {
} }
// signalstack sets the current thread's alternate signal stack to s. // signalstack sets the current thread's alternate signal stack to s.
// If s is nil, the current thread's alternate signal stack is disabled.
//go:nosplit //go:nosplit
func signalstack(s *stack) { func signalstack(s *stack) {
var st stackt st := stackt{ss_size: s.hi - s.lo}
if s == nil { setSignalstackSP(&st, s.lo)
st.ss_flags = _SS_DISABLE
} else {
setSignalstackSP(&st, s.lo)
st.ss_size = s.hi - s.lo
st.ss_flags = 0
}
sigaltstack(&st, nil) sigaltstack(&st, nil)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment