Skip to content

Commit e2e11f0

Browse files
runtime: unify Unix implementations of unminit
Change-Id: I2cbb13eb85876ad05a52cbd498a9b86e7a28899c Reviewed-on: https://go-review.googlesource.com/29772 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 6bcd258 commit e2e11f0

File tree

8 files changed

+16
-21
lines changed

8 files changed

+16
-21
lines changed

src/runtime/os3_solaris.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ func minit() {
214214

215215
// Called from dropm to undo the effect of an minit.
216216
func unminit() {
217-
if getg().m.newSigstack {
218-
signalstack(nil)
219-
}
217+
unminitSignals()
220218
}
221219

222220
func memlimit() uintptr {

src/runtime/os_darwin.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,7 @@ func minit() {
188188
// Called from dropm to undo the effect of an minit.
189189
//go:nosplit
190190
func unminit() {
191-
if getg().m.newSigstack {
192-
signalstack(nil)
193-
}
191+
unminitSignals()
194192
}
195193

196194
// Mach IPC, to get at semaphores

src/runtime/os_dragonfly.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ func minit() {
190190
// Called from dropm to undo the effect of an minit.
191191
//go:nosplit
192192
func unminit() {
193-
if getg().m.newSigstack {
194-
signalstack(nil)
195-
}
193+
unminitSignals()
196194
}
197195

198196
func memlimit() uintptr {

src/runtime/os_freebsd.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ func minit() {
180180
// Called from dropm to undo the effect of an minit.
181181
//go:nosplit
182182
func unminit() {
183-
if getg().m.newSigstack {
184-
signalstack(nil)
185-
}
183+
unminitSignals()
186184
}
187185

188186
func memlimit() uintptr {

src/runtime/os_linux.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@ func minit() {
266266
// Called from dropm to undo the effect of an minit.
267267
//go:nosplit
268268
func unminit() {
269-
if getg().m.newSigstack {
270-
signalstack(nil)
271-
}
269+
unminitSignals()
272270
}
273271

274272
func memlimit() uintptr {

src/runtime/os_netbsd.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,7 @@ func minit() {
244244
// Called from dropm to undo the effect of an minit.
245245
//go:nosplit
246246
func unminit() {
247-
if getg().m.newSigstack {
248-
signalstack(nil)
249-
}
247+
unminitSignals()
250248
}
251249

252250
func memlimit() uintptr {

src/runtime/os_openbsd.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ func minit() {
223223
// Called from dropm to undo the effect of an minit.
224224
//go:nosplit
225225
func unminit() {
226-
if getg().m.newSigstack {
227-
signalstack(nil)
228-
}
226+
unminitSignals()
229227
}
230228

231229
func memlimit() uintptr {

src/runtime/signal_unix.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,15 @@ func minitSignalMask() {
619619
sigprocmask(_SIG_SETMASK, &nmask, nil)
620620
}
621621

622+
// unminitSignals is called from dropm, via unminit, to undo the
623+
// effect of calling minit on a non-Go thread.
624+
//go:nosplit
625+
func unminitSignals() {
626+
if getg().m.newSigstack {
627+
signalstack(nil)
628+
}
629+
}
630+
622631
// setGsignalStack sets the gsignal stack of the current m to an
623632
// alternate signal stack returned from the sigaltstack system call.
624633
// This is used when handling a signal if non-Go code has set the

0 commit comments

Comments
 (0)