forked from golang/go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime: drop sigfwd from signal forwarding unsupported platforms
This change splits signal_unix.go into signal_unix.go and signal2_unix.go and removes the fake symbol sigfwd from signal forwarding unsupported platforms for clarification purpose. Change-Id: I205eab5cf1930fda8a68659b35cfa9f3a0e67ca6 Reviewed-on: https://go-review.googlesource.com/12062 Reviewed-by: Ian Lance Taylor <[email protected]>
- Loading branch information
Showing
11 changed files
with
48 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters