Skip to content

Commit

Permalink
runtime: Define Darwin handled signals list
Browse files Browse the repository at this point in the history
Fixes: #5990

Some signals may not be defined on non Linux host OSes, like
SIGSTKFLT for example. It's also not defined on certain architectures,
but irrelevant for this.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
Signed-off-by: Danny Canter <danny@dcantah.dev>
  • Loading branch information
Samuel Ortiz authored and dcantah committed Jan 6, 2023
1 parent 1b46d4f commit 3b4420e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/runtime/pkg/signals/signals.go
Expand Up @@ -23,21 +23,6 @@ var signalLog = logrus.WithField("default-signal-logger", true)
// or a fatal signal is received.
var CrashOnError = false

// List of handled signals.
//
// The value is true if receiving the signal should be fatal.
var handledSignalsMap = map[syscall.Signal]bool{
syscall.SIGABRT: true,
syscall.SIGBUS: true,
syscall.SIGILL: true,
syscall.SIGQUIT: true,
syscall.SIGSEGV: true,
syscall.SIGSTKFLT: true,
syscall.SIGSYS: true,
syscall.SIGTRAP: true,
syscall.SIGUSR1: false,
}

// DieCb is the callback function type that needs to be defined for every call
// into the Die() function. This callback will be run as the first function of
// the Die() implementation.
Expand Down
22 changes: 22 additions & 0 deletions src/runtime/pkg/signals/signals_darwin.go
@@ -0,0 +1,22 @@
// Copyright (c) 2023 Apple Inc.
//
// SPDX-License-Identifier: Apache-2.0
//

package signals

import "syscall"

// List of handled signals.
//
// The value is true if receiving the signal should be fatal.
var handledSignalsMap = map[syscall.Signal]bool{
syscall.SIGABRT: true,
syscall.SIGBUS: true,
syscall.SIGILL: true,
syscall.SIGQUIT: true,
syscall.SIGSEGV: true,
syscall.SIGSYS: true,
syscall.SIGTRAP: true,
syscall.SIGUSR1: false,
}
23 changes: 23 additions & 0 deletions src/runtime/pkg/signals/signals_linux.go
@@ -0,0 +1,23 @@
// Copyright 2018 Intel Corporation.
//
// SPDX-License-Identifier: Apache-2.0
//

package signals

import "syscall"

// List of handled signals.
//
// The value is true if receiving the signal should be fatal.
var handledSignalsMap = map[syscall.Signal]bool{
syscall.SIGABRT: true,
syscall.SIGBUS: true,
syscall.SIGILL: true,
syscall.SIGQUIT: true,
syscall.SIGSEGV: true,
syscall.SIGSTKFLT: true,
syscall.SIGSYS: true,
syscall.SIGTRAP: true,
syscall.SIGUSR1: false,
}

0 comments on commit 3b4420e

Please sign in to comment.