Support SIGRTMIN+n signals
systemd uses SIGRTMIN+n signals, but containerd didn't support the signals since Go's sys/unix doesn't support them. This change introduces SIGRTMIN+n handling by utilizing moby/sys/signal. Fixes #5402. https://www.freedesktop.org/software/systemd/man/systemd.html#Signals Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
14
signals.go
14
signals.go
@@ -24,6 +24,7 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/moby/sys/signal"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
@@ -40,7 +41,7 @@ func GetStopSignal(ctx context.Context, container Container, defaultSignal sysca
|
||||
}
|
||||
|
||||
if stopSignal, ok := labels[StopSignalLabel]; ok {
|
||||
return ParseSignal(stopSignal)
|
||||
return signal.ParseSignal(stopSignal)
|
||||
}
|
||||
|
||||
return defaultSignal, nil
|
||||
@@ -48,7 +49,7 @@ func GetStopSignal(ctx context.Context, container Container, defaultSignal sysca
|
||||
|
||||
// GetOCIStopSignal retrieves the stop signal specified in the OCI image config
|
||||
func GetOCIStopSignal(ctx context.Context, image Image, defaultSignal string) (string, error) {
|
||||
_, err := ParseSignal(defaultSignal)
|
||||
_, err := signal.ParseSignal(defaultSignal)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -81,3 +82,12 @@ func GetOCIStopSignal(ctx context.Context, image Image, defaultSignal string) (s
|
||||
|
||||
return config.StopSignal, nil
|
||||
}
|
||||
|
||||
// ParseSignal parses a given string into a syscall.Signal
|
||||
// the rawSignal can be a string with "SIG" prefix,
|
||||
// or a signal number in string format.
|
||||
//
|
||||
// Deprecated: Use github.com/moby/sys/signal instead.
|
||||
func ParseSignal(rawSignal string) (syscall.Signal, error) {
|
||||
return signal.ParseSignal(rawSignal)
|
||||
}
|
||||
|
Reference in New Issue
Block a user