Revert "runtime: handle SIGPIPE in c-archive and c-shared programs"

This reverts commit d24b57a6a1.

Reason for revert: Further complications arised (issue 18100). We'll try again in Go 1.9.

Change-Id: I5ca93d2643a4be877dd9c2d8df3359718440f02f
Reviewed-on: https://go-review.googlesource.com/33770
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
This commit is contained in:
Elias Naur 2016-12-01 09:31:08 +00:00
parent 16c33992e0
commit 0b2daa5650
8 changed files with 9 additions and 136 deletions

View file

@ -111,8 +111,8 @@ func sigInstallGoHandler(sig uint32) bool {
}
// When built using c-archive or c-shared, only install signal
// handlers for synchronous signals and SIGPIPE.
if (isarchive || islibrary) && t.flags&_SigPanic == 0 && sig != _SIGPIPE {
// handlers for synchronous signals.
if (isarchive || islibrary) && t.flags&_SigPanic == 0 {
return false
}
@ -497,15 +497,9 @@ func sigfwdgo(sig uint32, info *siginfo, ctx unsafe.Pointer) bool {
return true
}
// Only forward synchronous signals.
c := &sigctxt{info, ctx}
// Only forward signals from the kernel.
// On Linux and Darwin there is no way to distinguish a SIGPIPE raised by a write
// to a closed socket or pipe from a SIGPIPE raised by kill or pthread_kill
// so we'll treat every SIGPIPE as kernel-generated.
userSig := c.sigcode() == _SI_USER &&
(sig != _SIGPIPE || GOOS != "linux" && GOOS != "android" && GOOS != "darwin")
// Only forward synchronous signals and SIGPIPE.
if userSig || flags&_SigPanic == 0 && sig != _SIGPIPE {
if c.sigcode() == _SI_USER || flags&_SigPanic == 0 {
return false
}
// Determine if the signal occurred inside Go code. We test that: