Skip to content

Commit

Permalink
Merge pull request #8797 from Luap99/fix-mips-build
Browse files Browse the repository at this point in the history
Fix build for mips architecture
  • Loading branch information
openshift-merge-robot authored Dec 22, 2020
2 parents b4692f2 + 1ad7966 commit cfdb8fb
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/signal/signal_linux.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// +build linux
// +build !mips,!mipsle,!mips64,!mips64le

// Signal handling for Linux only.
package signal
Expand Down
106 changes: 106 additions & 0 deletions pkg/signal/signal_linux_mipsx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// +build linux
// +build mips mipsle mips64 mips64le

// Special signal handling for mips architecture
package signal

// Copyright 2013-2018 Docker, Inc.

// NOTE: this package has originally been copied from github.com/docker/docker.

import (
"os"
"os/signal"
"syscall"

"golang.org/x/sys/unix"
)

const (
sigrtmin = 34
sigrtmax = 127
)

// 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,
}

// CatchAll catches all signals and relays them to the specified channel.
func CatchAll(sigc chan os.Signal) {
handledSigs := make([]os.Signal, 0, len(signalMap))
for _, s := range signalMap {
handledSigs = append(handledSigs, s)
}
signal.Notify(sigc, handledSigs...)
}

// StopCatch stops catching the signals and closes the specified channel.
func StopCatch(sigc chan os.Signal) {
signal.Stop(sigc)
close(sigc)
}

2 comments on commit cfdb8fb

@dangowrt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2020-12-21T13:05:01.4900295Z # github.com/containers/podman/v2/pkg/signal
2020-12-21T13:05:01.4900946Z ../../pkg/signal/signal_common.go:20:13: undefined: signalMap
2020-12-21T13:05:01.4901542Z ../../pkg/signal/signal_common.go:35:20: undefined: signalMap
2020-12-21T13:05:01.4902148Z ../../pkg/signal/signal_linux_mipsx.go:95:42: undefined: signalMap
2020-12-21T13:05:01.4902778Z ../../pkg/signal/signal_linux_mipsx.go:96:20: undefined: signalMap

See openwrt/packages#14294 where this commit is imported as a patch on top of podman 2.2.1.

@dangowrt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.