childowner

package
v0.0.0-...-0b698e0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0, MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package childowner retains control of one original started child until its single terminal Wait. Nothing here reconstructs authority from a stored PID.

Index

Constants

This section is empty.

Variables

View Source
var ErrPauseState = errors.New("original child pause state differs")
View Source
var ErrRetired = errors.New("original child control authority is retired")

Functions

func Available

func Available() error

Available checks the native observer before any child is started. The current process cannot be its own child, so ECHILD is the expected result.

Types

type Owner

type Owner struct {
	// contains filtered or unexported fields
}

Owner is process-local, never serialized or reconstructed after recovery. Its mutex serializes signals and the irreversible retirement before Wait.

func New

func New(cmd *exec.Cmd) (*Owner, error)

func (*Owner) Active

func (o *Owner) Active() bool

func (*Owner) OwnsUnreaped

func (o *Owner) OwnsUnreaped(cmd *exec.Cmd) bool

OwnsUnreaped confirms the exact original command handle without exposing a PID as a reusable capability. It cannot restore ownership after Wait begins retiring signals, even if a stored row still contains the old number.

func (*Owner) Pause

func (o *Owner) Pause() error

Pause and Resume control only this process-local original owner. They are separate from Signal so an already terminal leader cannot receive a late STOP or CONT through a reused numeric process group. The Manager reserves a validated lease/action/clock effect before calling either method.

func (*Owner) Paused

func (o *Owner) Paused() bool

func (*Owner) Resume

func (o *Owner) Resume() error

func (*Owner) RetirePressureControls

func (o *Owner) RetirePressureControls()

RetirePressureControls is a nonblocking end/revocation cut. It never retires TERM/KILL or the sole Wait needed to clean up the original child.

func (*Owner) Signal

func (o *Owner) Signal(sig syscall.Signal) error

func (*Owner) TryOwnsUnreaped

func (o *Owner) TryOwnsUnreaped(cmd *exec.Cmd) bool

TryOwnsUnreaped lets a Manager holding its bookkeeping lock refuse a busy original observer immediately. It never waits for Owner.mu in that order.

func (*Owner) TryPaused

func (o *Owner) TryPaused() (bool, bool)

TryPaused is a conservative snapshot for a Manager final fence. Busy owner observation withdraws the effect instead of blocking lease bookkeeping.

func (*Owner) Wait

func (o *Owner) Wait(ctx context.Context) Result

Wait observes the leader without reaping it. A terminal unreaped leader is still the original PID anchor while descendants receive the final KILL. Retirement precedes the sole native Wait; later callers can never signal a numeric PID that the OS may have reused. Signal/observation/join failures remain failures even when a later read appears healthy.

type Result

type Result struct {
	WaitError    error
	CleanupError error
	Reaped       bool
}

Jump to

Keyboard shortcuts

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