pkg/signal: ignore SIGURG on all platforms

Other Unix platforms (e.g. Darwin) are also affected by the Go
runtime sending SIGURG.

This patch changes how we match the signal by just looking for the
"URG" name, which should handle any platform that has this signal
defined in the SignalMap.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-05-25 12:07:53 +02:00
parent e02bc91dcb
commit 05f520dd3c
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
6 changed files with 4 additions and 29 deletions

View File

@ -12,13 +12,13 @@ import (
)
// CatchAll catches all signals and relays them to the specified channel.
// On Linux, SIGURG is not handled, as it's used by the Go runtime to support
// SIGURG is not handled, as it's used by the Go runtime to support
// preemptable system calls.
func CatchAll(sigc chan os.Signal) {
var handledSigs []os.Signal
for _, s := range SignalMap {
if isRuntimeSig(s) {
// Do not handle SIGURG on Linux, as in go1.14+, the go runtime issues
for n, s := range SignalMap {
if n == "URG" {
// Do not handle SIGURG, as in go1.14+, the go runtime issues
// SIGURG as an interrupt to support preemptable system calls on Linux.
continue
}

View File

@ -1,7 +1,6 @@
package signal // import "github.com/docker/docker/pkg/signal"
import (
"os"
"syscall"
)
@ -40,7 +39,3 @@ var SignalMap = map[string]syscall.Signal{
"XCPU": syscall.SIGXCPU,
"XFSZ": syscall.SIGXFSZ,
}
func isRuntimeSig(_ os.Signal) bool {
return false
}

View File

@ -1,7 +1,6 @@
package signal // import "github.com/docker/docker/pkg/signal"
import (
"os"
"syscall"
)
@ -42,7 +41,3 @@ var SignalMap = map[string]syscall.Signal{
"XCPU": syscall.SIGXCPU,
"XFSZ": syscall.SIGXFSZ,
}
func isRuntimeSig(_ os.Signal) bool {
return false
}

View File

@ -3,7 +3,6 @@
package signal // import "github.com/docker/docker/pkg/signal"
import (
"os"
"syscall"
"golang.org/x/sys/unix"
@ -82,7 +81,3 @@ var SignalMap = map[string]syscall.Signal{
"RTMAX-1": sigrtmax - 1,
"RTMAX": sigrtmax,
}
func isRuntimeSig(s os.Signal) bool {
return s == unix.SIGURG
}

View File

@ -4,7 +4,6 @@
package signal // import "github.com/docker/docker/pkg/signal"
import (
"os"
"syscall"
"golang.org/x/sys/unix"
@ -83,7 +82,3 @@ var SignalMap = map[string]syscall.Signal{
"RTMAX-1": sigrtmax - 1,
"RTMAX": sigrtmax,
}
func isRuntimeSig(s os.Signal) bool {
return s == unix.SIGURG
}

View File

@ -1,7 +1,6 @@
package signal // import "github.com/docker/docker/pkg/signal"
import (
"os"
"syscall"
)
@ -25,7 +24,3 @@ var SignalMap = map[string]syscall.Signal{
"KILL": syscall.SIGKILL,
"TERM": syscall.SIGTERM,
}
func isRuntimeSig(_ os.Signal) bool {
return false
}