Define all of the signals defined by kill -l

1) SIGHUP	 2) SIGINT	 3) SIGQUIT	 4) SIGILL	 5) SIGTRAP
 6) SIGABRT	 7) SIGBUS	 8) SIGFPE	 9) SIGKILL	10) SIGUSR1
11) SIGSEGV	12) SIGUSR2	13) SIGPIPE	14) SIGALRM	15) SIGTERM
16) SIGSTKFLT	17) SIGCHLD	18) SIGCONT	19) SIGSTOP	20) SIGTSTP
21) SIGTTIN	22) SIGTTOU	23) SIGURG	24) SIGXCPU	25) SIGXFSZ
26) SIGVTALRM	27) SIGPROF	28) SIGWINCH	29) SIGIO	30) SIGPWR
31) SIGSYS	34) SIGRTMIN	35) SIGRTMIN+1	36) SIGRTMIN+2	37) SIGRTMIN+3
38) SIGRTMIN+4	39) SIGRTMIN+5	40) SIGRTMIN+6	41) SIGRTMIN+7	42) SIGRTMIN+8
43) SIGRTMIN+9	44) SIGRTMIN+10	45) SIGRTMIN+11	46) SIGRTMIN+12	47) SIGRTMIN+13
48) SIGRTMIN+14	49) SIGRTMIN+15	50) SIGRTMAX-14	51) SIGRTMAX-13	52) SIGRTMAX-12
53) SIGRTMAX-11	54) SIGRTMAX-10	55) SIGRTMAX-9	56) SIGRTMAX-8	57) SIGRTMAX-7
58) SIGRTMAX-6	59) SIGRTMAX-5	60) SIGRTMAX-4	61) SIGRTMAX-3	62) SIGRTMAX-2
63) SIGRTMAX-1	64) SIGRTMAX

This will allow users to specify signals by name.  Needed to make docker run --stop-signal
work as defined by systemd.

man systemd

defines the proper way to shutdown a systemd running as pid 1 in a container as

SIGRTMIN+4

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
Dan Walsh 2015-11-07 11:53:10 +01:00
parent 9c6e3396ef
commit d1ae13b0b0

View file

@ -4,41 +4,77 @@ import (
"syscall" "syscall"
) )
const (
sigrtmin = 34
sigrtmax = 64
)
// SignalMap is a map of Linux signals. // SignalMap is a map of Linux signals.
var SignalMap = map[string]syscall.Signal{ var SignalMap = map[string]syscall.Signal{
"ABRT": syscall.SIGABRT, "ABRT": syscall.SIGABRT,
"ALRM": syscall.SIGALRM, "ALRM": syscall.SIGALRM,
"BUS": syscall.SIGBUS, "BUS": syscall.SIGBUS,
"CHLD": syscall.SIGCHLD, "CHLD": syscall.SIGCHLD,
"CLD": syscall.SIGCLD, "CLD": syscall.SIGCLD,
"CONT": syscall.SIGCONT, "CONT": syscall.SIGCONT,
"FPE": syscall.SIGFPE, "FPE": syscall.SIGFPE,
"HUP": syscall.SIGHUP, "HUP": syscall.SIGHUP,
"ILL": syscall.SIGILL, "ILL": syscall.SIGILL,
"INT": syscall.SIGINT, "INT": syscall.SIGINT,
"IO": syscall.SIGIO, "IO": syscall.SIGIO,
"IOT": syscall.SIGIOT, "IOT": syscall.SIGIOT,
"KILL": syscall.SIGKILL, "KILL": syscall.SIGKILL,
"PIPE": syscall.SIGPIPE, "PIPE": syscall.SIGPIPE,
"POLL": syscall.SIGPOLL, "POLL": syscall.SIGPOLL,
"PROF": syscall.SIGPROF, "PROF": syscall.SIGPROF,
"PWR": syscall.SIGPWR, "PWR": syscall.SIGPWR,
"QUIT": syscall.SIGQUIT, "QUIT": syscall.SIGQUIT,
"SEGV": syscall.SIGSEGV, "SEGV": syscall.SIGSEGV,
"STKFLT": syscall.SIGSTKFLT, "STKFLT": syscall.SIGSTKFLT,
"STOP": syscall.SIGSTOP, "STOP": syscall.SIGSTOP,
"SYS": syscall.SIGSYS, "SYS": syscall.SIGSYS,
"TERM": syscall.SIGTERM, "TERM": syscall.SIGTERM,
"TRAP": syscall.SIGTRAP, "TRAP": syscall.SIGTRAP,
"TSTP": syscall.SIGTSTP, "TSTP": syscall.SIGTSTP,
"TTIN": syscall.SIGTTIN, "TTIN": syscall.SIGTTIN,
"TTOU": syscall.SIGTTOU, "TTOU": syscall.SIGTTOU,
"UNUSED": syscall.SIGUNUSED, "UNUSED": syscall.SIGUNUSED,
"URG": syscall.SIGURG, "URG": syscall.SIGURG,
"USR1": syscall.SIGUSR1, "USR1": syscall.SIGUSR1,
"USR2": syscall.SIGUSR2, "USR2": syscall.SIGUSR2,
"VTALRM": syscall.SIGVTALRM, "VTALRM": syscall.SIGVTALRM,
"WINCH": syscall.SIGWINCH, "WINCH": syscall.SIGWINCH,
"XCPU": syscall.SIGXCPU, "XCPU": syscall.SIGXCPU,
"XFSZ": syscall.SIGXFSZ, "XFSZ": syscall.SIGXFSZ,
"RTMIN": sigrtmin,
"RTMIN+1": sigrtmin + 1,
"RTMIN+2": sigrtmin + 2,
"RTMIN+3": sigrtmin + 3,
"RTMIN+4": sigrtmin + 4,
"RTMIN+5": sigrtmin + 5,
"RTMIN+6": sigrtmin + 6,
"RTMIN+7": sigrtmin + 7,
"RTMIN+8": sigrtmin + 8,
"RTMIN+9": sigrtmin + 9,
"RTMIN+10": sigrtmin + 10,
"RTMIN+11": sigrtmin + 11,
"RTMIN+12": sigrtmin + 12,
"RTMIN+13": sigrtmin + 13,
"RTMIN+14": sigrtmin + 14,
"RTMIN+15": sigrtmin + 15,
"RTMAX-14": sigrtmax - 14,
"RTMAX-13": sigrtmax - 13,
"RTMAX-12": sigrtmax - 12,
"RTMAX-11": sigrtmax - 11,
"RTMAX-10": sigrtmax - 10,
"RTMAX-9": sigrtmax - 9,
"RTMAX-8": sigrtmax - 8,
"RTMAX-7": sigrtmax - 7,
"RTMAX-6": sigrtmax - 6,
"RTMAX-5": sigrtmax - 5,
"RTMAX-4": sigrtmax - 4,
"RTMAX-3": sigrtmax - 3,
"RTMAX-2": sigrtmax - 2,
"RTMAX-1": sigrtmax - 1,
"RTMAX": sigrtmax,
} }