pid1

package
v0.1.0-proto2m Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package pid1 installs the explicit PID-1 signal semantics (GAPI-DIV-027). The kernel suppresses default signal handling for pid 1 - SIGTERM to an init without a handler is silently dropped - so every signal this process answers is registered explicitly, with no implicit defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(ctx context.Context, h Handlers) (stop func())

Install registers the PID-1 signal set and dispatches to the handlers until ctx ends or the returned stop function is called.

Types

type Handlers

type Handlers struct {
	// Shutdown answers SIGTERM (graceful shutdown) and SIGINT
	// (ctrl-alt-del via the kernel); the signal is passed through so
	// the executor can distinguish them.
	Shutdown func(os.Signal)
	// Reload answers SIGHUP.
	Reload func()
	// Reap answers SIGCHLD - a kick for the subreaper's reap loop.
	Reap func()
	// Debug answers SIGUSR1 (rotate logs / debug dump).
	Debug func()
	// Emergency answers SIGUSR2 (emergency shell hook).
	Emergency func()
}

Handlers holds the explicit semantics for each PID-1 signal. A nil handler absorbs its signal (registered but inert): PID 1 must never die to a default disposition.

Jump to

Keyboard shortcuts

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