subreaper

package
v0.1.0-proto2b Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package subreaper implements the PID-1 orphan-reaping obligation (GAPI-DIV-027): the supervisor registers as a child subreaper so orphaned descendants reparent to it instead of pid 1, and a reap loop collects their exit statuses - zombie accumulation is a kernel obligation, not an optimization. Linux-only by nature; non-Linux builds compile and refuse.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("subreaper: linux-only")

ErrUnsupported: subreaper semantics are a Linux prctl feature.

Functions

func BecomeSubreaper

func BecomeSubreaper() error

BecomeSubreaper marks this process as a child subreaper: orphaned descendants reparent to it rather than to pid 1. Called before any other initialization (Phase 0); when the process IS pid 1 the call is a harmless no-op for correctness but kept for uniformity.

func ReapLoop

func ReapLoop(ctx context.Context, sigchld <-chan os.Signal, notify func(pid int, ws syscall.WaitStatus))

ReapLoop drains terminated children for the supervisor's lifetime. It triggers on SIGCHLD (caller supplies the subscribed channel), on a safety tick (coalesced or pre-subscription signal edges must not strand zombies), and once at startup. Every reaped pid is forwarded to notify with its true wait status; the agent manager decides whether it was a known agent or an adopted orphan.

Types

This section is empty.

Jump to

Keyboard shortcuts

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