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 ¶
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.