//go:noescape
func sigaltstack(new, old *sigaltstackt)
-//go:noescape
-func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer)
-
//go:noescape
func sigaction(sig int32, new, old *sigactiont)
//go:noescape
func sigaltstack(new, old *stackt)
-//go:noescape
-func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer)
-
//go:noescape
func sigaction(sig int32, new, old *sigactiont)
//go:noescape
func sigaltstack(new, old *sigaltstackt)
-//go:noescape
-func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer)
-
//go:noescape
func setitimer(mode int32, new, old *itimerval)
panicmem()
}
-func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer) {
- throw("sigfwd not implemented")
-}
-
func raiseproc(sig int32) {
}
//go:noescape
func sigaltstack(new, old *sigaltstackt)
-func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer) {
- throw("sigfwd not implemented")
-}
-
//go:noescape
func sigprocmask(mode int32, new, old *sigset)
package runtime
-import "unsafe"
-
//go:noescape
func setitimer(mode int32, new, old *itimerval)
//go:noescape
func sigaltstack(new, old *stackt)
-//go:noescape
-func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer)
-
//go:noescape
func sigprocmask(mode int32, new uint32) uint32
var asmsysvicall6 libcFunc
-//go:noescape
-func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer)
-
//go:nosplit
func sysvicall0(fn *libcFunc) uintptr {
libcall := &getg().m.libcall
// handle a particular signal (e.g., signal occurred on a non-Go thread).
// See sigfwdgo() for more information on when the signals are forwarded.
//
-// Signal forwarding is currently available only on Linux.
+// Signal forwarding is currently available only on Darwin and Linux.
var fwdSig [_NSIG]uintptr
// sigmask represents a general signal mask compatible with the GOOS
--- /dev/null
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build darwin linux
+
+package runtime
+
+import "unsafe"
+
+//go:noescape
+func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer)
+
+// Determines if the signal should be handled by Go and if not, forwards the
+// signal to the handler that was installed before Go's. Returns whether the
+// signal was forwarded.
+//go:nosplit
+func sigfwdgo(sig uint32, info *siginfo, ctx unsafe.Pointer) bool {
+ g := getg()
+ c := &sigctxt{info, ctx}
+ if sig >= uint32(len(sigtable)) {
+ return false
+ }
+ fwdFn := fwdSig[sig]
+ flags := sigtable[sig].flags
+
+ // If there is no handler to forward to, no need to forward.
+ if fwdFn == _SIG_DFL {
+ return false
+ }
+ // Only forward synchronous signals.
+ if c.sigcode() == _SI_USER || flags&_SigPanic == 0 {
+ return false
+ }
+ // Determine if the signal occurred inside Go code. We test that:
+ // (1) we were in a goroutine (i.e., m.curg != nil), and
+ // (2) we weren't in CGO (i.e., m.curg.syscallsp == 0).
+ if g != nil && g.m != nil && g.m.curg != nil && g.m.curg.syscallsp == 0 {
+ return false
+ }
+ // Signal not handled by Go, forward it.
+ if fwdFn != _SIG_IGN {
+ sigfwd(fwdFn, sig, info, ctx)
+ }
+ return true
+}
/* 31 */ {_SigNotify, "SIGUSR2: user-defined signal 2"},
}
-//go:noescape
-func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer)
-
//go:noescape
func sigreturn(ctx unsafe.Pointer, infostyle uint32)
package runtime
-import "unsafe"
+import _ "unsafe" // for go:linkname
//go:linkname os_sigpipe os.sigpipe
func os_sigpipe() {
systemstack(sigpipe)
}
-
-// Determines if the signal should be handled by Go and if not, forwards the
-// signal to the handler that was installed before Go's. Returns whether the
-// signal was forwarded.
-//go:nosplit
-func sigfwdgo(sig uint32, info *siginfo, ctx unsafe.Pointer) bool {
- g := getg()
- c := &sigctxt{info, ctx}
- if sig >= uint32(len(sigtable)) {
- return false
- }
- fwdFn := fwdSig[sig]
- flags := sigtable[sig].flags
-
- // If there is no handler to forward to, no need to forward.
- if fwdFn == _SIG_DFL {
- return false
- }
- // Only forward synchronous signals.
- if c.sigcode() == _SI_USER || flags&_SigPanic == 0 {
- return false
- }
- // Determine if the signal occurred inside Go code. We test that:
- // (1) we were in a goroutine (i.e., m.curg != nil), and
- // (2) we weren't in CGO (i.e., m.curg.syscallsp == 0).
- if g != nil && g.m != nil && g.m.curg != nil && g.m.curg.syscallsp == 0 {
- return false
- }
- // Signal not handled by Go, forward it.
- if fwdFn != _SIG_IGN {
- sigfwd(fwdFn, sig, info, ctx)
- }
- return true
-}