sighandling

package
v0.0.0-...-9ec6d29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2022 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Overview

Package sighandling contains helpers for handling signals to applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IgnoreChildStop

func IgnoreChildStop() error

IgnoreChildStop sets the SA_NOCLDSTOP flag, causing child processes to not generate SIGCHLD when they stop.

func ReplaceSignalHandler

func ReplaceSignalHandler(sig unix.Signal, handler uintptr, previous *uintptr) error

ReplaceSignalHandler replaces the existing signal handler for the provided signal with the function pointer at `handler`. This bypasses the Go runtime signal handlers, and should only be used for low-level signal handlers where use of signal.Notify is not appropriate.

It stores the value of the previously set handler in previous.

func StartSignalForwarding

func StartSignalForwarding(handler func(linux.Signal)) func()

StartSignalForwarding ensures that synchronous signals are passed to the given handler function and returns a callback that stops signal delivery.

Note that this function permanently takes over signal handling. After the stop callback, signals revert to the default Go runtime behavior, which cannot be overridden with external calls to signal.Notify.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL