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. // 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. // preemptable system calls.
func CatchAll(sigc chan os.Signal) { func CatchAll(sigc chan os.Signal) {
var handledSigs []os.Signal var handledSigs []os.Signal
for _, s := range SignalMap { for n, s := range SignalMap {
if isRuntimeSig(s) { if n == "URG" {
// Do not handle SIGURG on Linux, as in go1.14+, the go runtime issues // Do not handle SIGURG, as in go1.14+, the go runtime issues
// SIGURG as an interrupt to support preemptable system calls on Linux. // SIGURG as an interrupt to support preemptable system calls on Linux.
continue continue
} }

View file

@ -1,7 +1,6 @@
package signal // import "github.com/docker/docker/pkg/signal" package signal // import "github.com/docker/docker/pkg/signal"
import ( import (
"os"
"syscall" "syscall"
) )
@ -40,7 +39,3 @@ var SignalMap = map[string]syscall.Signal{
"XCPU": syscall.SIGXCPU, "XCPU": syscall.SIGXCPU,
"XFSZ": syscall.SIGXFSZ, "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" package signal // import "github.com/docker/docker/pkg/signal"
import ( import (
"os"
"syscall" "syscall"
) )
@ -42,7 +41,3 @@ var SignalMap = map[string]syscall.Signal{
"XCPU": syscall.SIGXCPU, "XCPU": syscall.SIGXCPU,
"XFSZ": syscall.SIGXFSZ, "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" package signal // import "github.com/docker/docker/pkg/signal"
import ( import (
"os"
"syscall" "syscall"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
@ -82,7 +81,3 @@ var SignalMap = map[string]syscall.Signal{
"RTMAX-1": sigrtmax - 1, "RTMAX-1": sigrtmax - 1,
"RTMAX": sigrtmax, "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" package signal // import "github.com/docker/docker/pkg/signal"
import ( import (
"os"
"syscall" "syscall"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
@ -83,7 +82,3 @@ var SignalMap = map[string]syscall.Signal{
"RTMAX-1": sigrtmax - 1, "RTMAX-1": sigrtmax - 1,
"RTMAX": sigrtmax, "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" package signal // import "github.com/docker/docker/pkg/signal"
import ( import (
"os"
"syscall" "syscall"
) )
@ -25,7 +24,3 @@ var SignalMap = map[string]syscall.Signal{
"KILL": syscall.SIGKILL, "KILL": syscall.SIGKILL,
"TERM": syscall.SIGTERM, "TERM": syscall.SIGTERM,
} }
func isRuntimeSig(_ os.Signal) bool {
return false
}