diff options
author | Ian Lance Taylor <iant@golang.org> | 2016-09-23 17:54:51 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2016-09-24 01:39:48 +0000 |
commit | ab552aa3b69deb208b38677880e86aa41c3a9e47 (patch) | |
tree | 076f3b41a7a38d30581f206e0a90b59e32129190 /src/runtime/os3_solaris.go | |
parent | fd296282e0a5058351954f1a7ea2dac5ef87f052 (diff) | |
download | go-ab552aa3b69deb208b38677880e86aa41c3a9e47.tar.gz go-ab552aa3b69deb208b38677880e86aa41c3a9e47.zip |
runtime: unify some signal handling functions
Unify the OS-specific versions of msigsave, msigrestore, sigblock,
updatesigmask, and unblocksig into single versions in signal_unix.go.
To do this, make sigprocmask work the same way on all systems, which
required adding a definition of sigprocmask for linux and openbsd.
Also add a single OS-specific function sigmaskToSigset.
Change-Id: I7cbf75131dddb57eeefe648ef845b0791404f785
Reviewed-on: https://go-review.googlesource.com/29689
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/runtime/os3_solaris.go')
-rw-r--r-- | src/runtime/os3_solaris.go | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/runtime/os3_solaris.go b/src/runtime/os3_solaris.go index 03a6c1a16d..d8390d6b1e 100644 --- a/src/runtime/os3_solaris.go +++ b/src/runtime/os3_solaris.go @@ -204,21 +204,6 @@ func mpreinit(mp *m) { func miniterrno() -//go:nosplit -func msigsave(mp *m) { - sigprocmask(_SIG_SETMASK, nil, &mp.sigmask) -} - -//go:nosplit -func msigrestore(sigmask sigset) { - sigprocmask(_SIG_SETMASK, &sigmask, nil) -} - -//go:nosplit -func sigblock() { - sigprocmask(_SIG_SETMASK, &sigset_all, nil) -} - // Called to initialize a new m (including the bootstrap m). // Called on the new thread, cannot allocate memory. func minit() { @@ -348,16 +333,10 @@ func signalstack(s *stack) { //go:nosplit //go:nowritebarrierrec -func updatesigmask(m sigmask) { - var mask sigset - copy(mask.__sigbits[:], m[:]) - sigprocmask(_SIG_SETMASK, &mask, nil) -} - -func unblocksig(sig int32) { - var mask sigset - mask.__sigbits[(sig-1)/32] |= 1 << ((uint32(sig) - 1) & 31) - sigprocmask(_SIG_UNBLOCK, &mask, nil) +func sigmaskToSigset(m sigmask) sigset { + var set sigset + copy(set.__sigbits[:], m[:]) + return set } //go:nosplit |