From 46c4938c6d5c2d8f58ff5ad9ea59dc00c6fa2eda Mon Sep 17 00:00:00 2001 From: Stian Halseth Date: Thu, 27 Aug 2026 19:38:16 +0200 Subject: [PATCH] signal: add SignalMap for linux/sparc64 SPARC has no SIGSTKFLT, so x/sys/unix does not define it for sparc64 and the "STKFLT" entry in signal_linux.go does not compile there. SPARC uses SIGEMT in that slot, as the mips architectures do. Add signal_linux_sparc64.go and exclude sparc64 from signal_linux.go, following signal_linux_mipsx.go. The new file is that one with the build tag changed and sigrtmax set to 64 rather than 127, which leaves sigrtmin and sigrtmax matching the generic file, so the SIGSTKFLT/SIGEMT swap is the only substantive difference. One thing is still missing before the package builds on linux/sparc64: x/sys/unix has no syscall implementation for that architecture. That is a separate matter, being pursued upstream. This change was checked against a tree that has one, where the package's tests pass on an UltraSPARC T4-1. Signed-off-by: Stian Halseth --- signal/signal_linux.go | 2 +- signal/signal_linux_sparc64.go | 83 ++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 signal/signal_linux_sparc64.go diff --git a/signal/signal_linux.go b/signal/signal_linux.go index 9f794a6f..0c676940 100644 --- a/signal/signal_linux.go +++ b/signal/signal_linux.go @@ -1,4 +1,4 @@ -//go:build !mips && !mipsle && !mips64 && !mips64le +//go:build !mips && !mipsle && !mips64 && !mips64le && !sparc64 package signal diff --git a/signal/signal_linux_sparc64.go b/signal/signal_linux_sparc64.go new file mode 100644 index 00000000..5d236a17 --- /dev/null +++ b/signal/signal_linux_sparc64.go @@ -0,0 +1,83 @@ +//go:build linux && sparc64 + +package signal + +import ( + "syscall" + + "golang.org/x/sys/unix" +) + +const ( + sigrtmin = 34 + sigrtmax = 64 +) + +// SignalMap is a map of Linux signals. +var SignalMap = map[string]syscall.Signal{ + "ABRT": unix.SIGABRT, + "ALRM": unix.SIGALRM, + "BUS": unix.SIGBUS, + "CHLD": unix.SIGCHLD, + "CLD": unix.SIGCLD, + "CONT": unix.SIGCONT, + "FPE": unix.SIGFPE, + "HUP": unix.SIGHUP, + "ILL": unix.SIGILL, + "INT": unix.SIGINT, + "IO": unix.SIGIO, + "IOT": unix.SIGIOT, + "KILL": unix.SIGKILL, + "PIPE": unix.SIGPIPE, + "POLL": unix.SIGPOLL, + "PROF": unix.SIGPROF, + "PWR": unix.SIGPWR, + "QUIT": unix.SIGQUIT, + "SEGV": unix.SIGSEGV, + "EMT": unix.SIGEMT, + "STOP": unix.SIGSTOP, + "SYS": unix.SIGSYS, + "TERM": unix.SIGTERM, + "TRAP": unix.SIGTRAP, + "TSTP": unix.SIGTSTP, + "TTIN": unix.SIGTTIN, + "TTOU": unix.SIGTTOU, + "URG": unix.SIGURG, + "USR1": unix.SIGUSR1, + "USR2": unix.SIGUSR2, + "VTALRM": unix.SIGVTALRM, + "WINCH": unix.SIGWINCH, + "XCPU": unix.SIGXCPU, + "XFSZ": unix.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, +}