github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/signal/signal_unix.go (about) 1 //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || zos 2 // +build aix darwin dragonfly freebsd netbsd openbsd solaris zos 3 4 // Signal handling for Linux only. 5 package signal 6 7 import ( 8 "os" 9 "syscall" 10 ) 11 12 const ( 13 sigrtmin = 34 14 sigrtmax = 64 15 16 SIGWINCH = syscall.SIGWINCH 17 ) 18 19 // SignalMap is a map of Linux signals. 20 // These constants are sourced from the Linux version of golang.org/x/sys/unix 21 // (I don't see much risk of this changing). 22 // This should work as long as Podman only runs containers on Linux, which seems 23 // a safe assumption for now. 24 var SignalMap = map[string]syscall.Signal{ 25 "ABRT": syscall.Signal(0x6), 26 "ALRM": syscall.Signal(0xe), 27 "BUS": syscall.Signal(0x7), 28 "CHLD": syscall.Signal(0x11), 29 "CLD": syscall.Signal(0x11), 30 "CONT": syscall.Signal(0x12), 31 "FPE": syscall.Signal(0x8), 32 "HUP": syscall.Signal(0x1), 33 "ILL": syscall.Signal(0x4), 34 "INT": syscall.Signal(0x2), 35 "IO": syscall.Signal(0x1d), 36 "IOT": syscall.Signal(0x6), 37 "KILL": syscall.Signal(0x9), 38 "PIPE": syscall.Signal(0xd), 39 "POLL": syscall.Signal(0x1d), 40 "PROF": syscall.Signal(0x1b), 41 "PWR": syscall.Signal(0x1e), 42 "QUIT": syscall.Signal(0x3), 43 "SEGV": syscall.Signal(0xb), 44 "STKFLT": syscall.Signal(0x10), 45 "STOP": syscall.Signal(0x13), 46 "SYS": syscall.Signal(0x1f), 47 "TERM": syscall.Signal(0xf), 48 "TRAP": syscall.Signal(0x5), 49 "TSTP": syscall.Signal(0x14), 50 "TTIN": syscall.Signal(0x15), 51 "TTOU": syscall.Signal(0x16), 52 "URG": syscall.Signal(0x17), 53 "USR1": syscall.Signal(0xa), 54 "USR2": syscall.Signal(0xc), 55 "VTALRM": syscall.Signal(0x1a), 56 "WINCH": syscall.Signal(0x1c), 57 "XCPU": syscall.Signal(0x18), 58 "XFSZ": syscall.Signal(0x19), 59 "RTMIN": sigrtmin, 60 "RTMIN+1": sigrtmin + 1, 61 "RTMIN+2": sigrtmin + 2, 62 "RTMIN+3": sigrtmin + 3, 63 "RTMIN+4": sigrtmin + 4, 64 "RTMIN+5": sigrtmin + 5, 65 "RTMIN+6": sigrtmin + 6, 66 "RTMIN+7": sigrtmin + 7, 67 "RTMIN+8": sigrtmin + 8, 68 "RTMIN+9": sigrtmin + 9, 69 "RTMIN+10": sigrtmin + 10, 70 "RTMIN+11": sigrtmin + 11, 71 "RTMIN+12": sigrtmin + 12, 72 "RTMIN+13": sigrtmin + 13, 73 "RTMIN+14": sigrtmin + 14, 74 "RTMIN+15": sigrtmin + 15, 75 "RTMAX-14": sigrtmax - 14, 76 "RTMAX-13": sigrtmax - 13, 77 "RTMAX-12": sigrtmax - 12, 78 "RTMAX-11": sigrtmax - 11, 79 "RTMAX-10": sigrtmax - 10, 80 "RTMAX-9": sigrtmax - 9, 81 "RTMAX-8": sigrtmax - 8, 82 "RTMAX-7": sigrtmax - 7, 83 "RTMAX-6": sigrtmax - 6, 84 "RTMAX-5": sigrtmax - 5, 85 "RTMAX-4": sigrtmax - 4, 86 "RTMAX-3": sigrtmax - 3, 87 "RTMAX-2": sigrtmax - 2, 88 "RTMAX-1": sigrtmax - 1, 89 "RTMAX": sigrtmax, 90 } 91 92 // CatchAll catches all signals and relays them to the specified channel. 93 func CatchAll(sigc chan os.Signal) { 94 panic("Unsupported on non-linux platforms") 95 } 96 97 // StopCatch stops catching the signals and closes the specified channel. 98 func StopCatch(sigc chan os.Signal) { 99 panic("Unsupported on non-linux platforms") 100 }