...

Package signals

import "github.com/Microsoft/hcsshim/internal/signals"
Overview
Index

Overview ▾

Variables

var (
    // ErrInvalidSignal is the standard error for an invalid signal for a given
    // flavor of container WCOW/LCOW.
    ErrInvalidSignal = errors.New("invalid signal value")
)

func ValidateLCOW

func ValidateLCOW(signal int, signalsSupported bool) (*guestresource.SignalProcessOptionsLCOW, error)

ValidateLCOW validates that `signal` is an acceptable signal for LCOW based on `signalsSupported`.

If `signalsSupported==false` we verify that only SIGTERM/SIGKILL are sent. All other signals are not supported on downlevel platforms.

func ValidateSigstrLCOW

func ValidateSigstrLCOW(sigstr string, signalsSupported bool) (*guestresource.SignalProcessOptionsLCOW, error)

ValidateSigstrLCOW validates that `sigstr` is an acceptable signal for LCOW based on `signalsSupported`.

`sigstr` may either be the text name or integer value of the signal.

If `signalsSupported==false` we verify that only SIGTERM/SIGKILL are sent. All other signals are not supported on downlevel platforms.

func ValidateSigstrWCOW

func ValidateSigstrWCOW(sigstr string, signalsSupported bool) (*guestresource.SignalProcessOptionsWCOW, error)

ValidateSigstrWCOW validates that `sigstr` is an acceptable signal for WCOW based on `signalsSupported`.

`sigstr` may either be the text name or integer value of the signal.

If `signalsSupported==false` we verify that only SIGTERM/SIGKILL and CTRLSHUTDOWN are sent. All other signals are not supported on downlevel platforms.

By default WCOW orchestrators may still use Linux SIGTERM and SIGKILL semantics which will be properly translated to CTRLSHUTDOWN and `Terminate`. To detect when WCOW needs to `Terminate` the return signal will be `nil` and the return error will be `nil`.

func ValidateWCOW

func ValidateWCOW(signal int, signalsSupported bool) (*guestresource.SignalProcessOptionsWCOW, error)

ValidateWCOW validates that `signal` is an acceptable signal for WCOW based on `signalsSupported`.

If `signalsSupported==false` we verify that only SIGTERM/SIGKILL and CTRLSHUTDOWN are sent. All other signals are not supported on downlevel platforms.

By default WCOW orchestrators may still use Linux SIGTERM and SIGKILL semantics which will be properly translated to CTRLSHUTDOWN and `Terminate`. To detect when WCOW needs to `Terminate` the return signal will be `nil` and the return error will be `nil`.