]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: simplify signalstack by dropping nil as argument
authorIan Lance Taylor <iant@golang.org>
Tue, 27 Sep 2016 14:20:10 +0000 (07:20 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 27 Sep 2016 17:08:29 +0000 (17:08 +0000)
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: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/os_netbsd.go
src/runtime/signal_unix.go

index e9c049045511095862e1a8c261fec0f3b34f0a31..38deb26e9122a6f75b9970e3acbe96de5abf7479 100644 (file)
@@ -192,7 +192,8 @@ func newosproc(mp *m, stk unsafe.Pointer) {
 // At this point all signals are blocked, so there is no race.
 //go:nosplit
 func netbsdMstart() {
-       signalstack(nil)
+       st := stackt{ss_flags: _SS_DISABLE}
+       sigaltstack(&st, nil)
        mstart()
 }
 
index 3a262452210bb876f24582e068bdc5236694a71c..d74cb3bf3af457ae5ae2e5b9d129cc66ad9b1871 100644 (file)
@@ -624,7 +624,8 @@ func minitSignalMask() {
 //go:nosplit
 func unminitSignals() {
        if getg().m.newSigstack {
-               signalstack(nil)
+               st := stackt{ss_flags: _SS_DISABLE}
+               sigaltstack(&st, nil)
        }
 }
 
@@ -645,17 +646,10 @@ func setGsignalStack(st *stackt) {
 }
 
 // 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
 func signalstack(s *stack) {
-       var st stackt
-       if s == nil {
-               st.ss_flags = _SS_DISABLE
-       } else {
-               setSignalstackSP(&st, s.lo)
-               st.ss_size = s.hi - s.lo
-               st.ss_flags = 0
-       }
+       st := stackt{ss_size: s.hi - s.lo}
+       setSignalstackSP(&st, s.lo)
        sigaltstack(&st, nil)
 }