Documentation
¶
Overview ¶
Package shutdown is the PID-1 teardown executor (GAPI-DIV-027): a correct init shutdown is StopAll -> sync -> reverse umount -> reboot(2), replacing the naive grace + SIGKILL pattern. The privileged surface is an interface so the exact call order is asserted in unit tests without rebooting anything.
Index ¶
Constants ¶
const ( CmdPowerOff = unix.LINUX_REBOOT_CMD_POWER_OFF CmdRestart = unix.LINUX_REBOOT_CMD_RESTART CmdHalt = unix.LINUX_REBOOT_CMD_HALT )
reboot(2) commands, aliased so tests assert the mapping portably.
Variables ¶
This section is empty.
Functions ¶
func SystemShutdown ¶
func SystemShutdown(sys Syscalls, mgr AgentStopper, mountTable []mounts.MountSpec, action Action, grace time.Duration) error
SystemShutdown runs the phased teardown. StopAll is bounded by grace - a hung agent cannot block sync() - and the deadline derives from context.Background(), never an already-cancelled signal context. Unmount and StopAll failures are logged, not fatal: the machine is going down either way, and the remaining phases only make that safer.
Types ¶
type AgentStopper ¶
type AgentStopper interface {
StopAll() error
}
AgentStopper is the slice of the agent manager teardown needs.