1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/pkg/signal/signal_deprecated.go
Sebastiaan van Stijn e53f65a916
pkg/signal: remove DefaultStopSignal const
This const was previously living in pkg/signal, but with that package
being moved to its own module, it didn't make much sense to put docker's
defaults in a generic module.

The const from the "signal" package is currenlty used *both* by the CLI
and the daemon as a default value when creating containers. This put up
some questions:

a. should the default be non-exported, and private to the container
   package? After all, it's a _default_ (so should be used if _NOT_ set).
b. should the client actually setting a default, or instead just omit
   the value, unless specified by the user? having the client set a
   default also means that the daemon cannot change the default value
   because the client (or older clients) will override it.
c. consider defaults from the client and defaults of the daemon to be
   separate things, and create a default const in the CLI.

This patch implements option "a" (option "b" will be done separately,
as it involves the CLI code). This still leaves "c" open as an option,
if the CLI wants to set its own default.

Unfortunately, this change means we'll have to drop the alias for the
deprecated pkg/signal.DefaultStopSignal const, but a comment was left
instead, which can assist consumers of the const to find why it's no
longer there (a search showed the Docker CLI as the only consumer though).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-11 10:31:29 +02:00

55 lines
2.3 KiB
Go

// Package signal provides helper functions for dealing with signals across
// various operating systems.
package signal // import "github.com/docker/docker/pkg/signal"
import (
"github.com/docker/docker/pkg/stack"
msignal "github.com/moby/sys/signal"
)
var (
// DumpStacks appends the runtime stack into file in dir and returns full path
// to that file.
// Deprecated: use github.com/docker/docker/pkg/stack.Dump instead.
DumpStacks = stack.DumpToFile
// CatchAll catches all signals and relays them to the specified channel.
// SIGURG is not handled, as it's used by the Go runtime to support
// preemptable system calls.
// Deprecated: use github.com/moby/sys/signal.CatchAll instead
CatchAll = msignal.CatchAll
// StopCatch stops catching the signals and closes the specified channel.
// Deprecated: use github.com/moby/sys/signal.StopCatch instead
StopCatch = msignal.StopCatch
// ParseSignal translates a string to a valid syscall signal.
// It returns an error if the signal map doesn't include the given signal.
// Deprecated: use github.com/moby/sys/signal.ParseSignal instead
ParseSignal = msignal.ParseSignal
// ValidSignalForPlatform returns true if a signal is valid on the platform
// Deprecated: use github.com/moby/sys/signal.ValidSignalForPlatform instead
ValidSignalForPlatform = msignal.ValidSignalForPlatform
// SignalMap is a map of signals for the current platform.
// Deprecated: use github.com/moby/sys/signal.SignalMap instead
SignalMap = msignal.SignalMap
)
// Signals used in cli/command
const (
// SIGCHLD is a signal sent to a process when a child process terminates, is interrupted, or resumes after being interrupted.
// Deprecated: use github.com/moby/sys/signal.SIGCHLD instead
SIGCHLD = msignal.SIGCHLD
// SIGWINCH is a signal sent to a process when its controlling terminal changes its size
// Deprecated: use github.com/moby/sys/signal.SIGWINCH instead
SIGWINCH = msignal.SIGWINCH
// SIGPIPE is a signal sent to a process when a pipe is written to before the other end is open for reading
// Deprecated: use github.com/moby/sys/signal.SIGPIPE instead
SIGPIPE = msignal.SIGPIPE
// DefaultStopSignal has been deprecated and removed. The default value is
// now defined in github.com/docker/docker/container. Clients should omit
// the container's stop-signal field if the default should be used.
)