diff options
| author | Austin Clements <austin@google.com> | 2015-05-21 14:12:29 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2015-06-02 19:57:42 +0000 |
| commit | c02b8911d84662ff6d0745acba6f2fcb79cc5cd1 (patch) | |
| tree | 6ba7109ce6d29f1f972a44e16c28f7363a48d9bd /src/runtime/os1_linux.go | |
| parent | cc6a7fce533d7214c9cda0fc57af9ac948e61b7c (diff) | |
| download | go-c02b8911d84662ff6d0745acba6f2fcb79cc5cd1.tar.xz | |
runtime: clean up signalstack API
Currently signalstack takes a lower limit and a length and all calls
hard-code the passed length. Change the API to take a *stack and
compute the lower limit and length from the passed stack.
This will make it easier for the runtime to steal some space from the
top of the stack since it eliminates the hard-coded stack sizes.
Change-Id: I7d2a9f45894b221f4e521628c2165530bbc57d53
Reviewed-on: https://go-review.googlesource.com/10311
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/os1_linux.go')
| -rw-r--r-- | src/runtime/os1_linux.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/runtime/os1_linux.go b/src/runtime/os1_linux.go index 02f98d7c5f..8aa0804860 100644 --- a/src/runtime/os1_linux.go +++ b/src/runtime/os1_linux.go @@ -202,7 +202,7 @@ func msigsave(mp *m) { func minit() { // Initialize signal handling. _g_ := getg() - signalstack((*byte)(unsafe.Pointer(_g_.m.gsignal.stack.lo)), 32*1024) + signalstack(&_g_.m.gsignal.stack) // restore signal mask from m.sigmask and unblock essential signals nmask := *(*sigset)(unsafe.Pointer(&_g_.m.sigmask)) @@ -219,7 +219,7 @@ func unminit() { _g_ := getg() smask := (*sigset)(unsafe.Pointer(&_g_.m.sigmask)) rtsigprocmask(_SIG_SETMASK, smask, nil, int32(unsafe.Sizeof(*smask))) - signalstack(nil, 0) + signalstack(nil) } func memlimit() uintptr { @@ -311,13 +311,14 @@ func getsig(i int32) uintptr { return sa.sa_handler } -func signalstack(p *byte, n int32) { +func signalstack(s *stack) { var st sigaltstackt - st.ss_sp = p - st.ss_size = uintptr(n) - st.ss_flags = 0 - if p == nil { + if s == nil { st.ss_flags = _SS_DISABLE + } else { + st.ss_sp = (*byte)(unsafe.Pointer(s.lo)) + st.ss_size = s.hi - s.lo + st.ss_flags = 0 } sigaltstack(&st, nil) } |
