Documentation
¶
Overview ¶
Package procs implements process-table helpers (filter, sort) and process actions (terminate, force kill).
Index ¶
- Variables
- func Filter(procs []collector.Proc, needle string) []collector.Proc
- func ForceKill(pid int32) error
- func Kill(pid int32) error
- func SendSignal(pid int32, name string) error
- func SignalIndex(name string) int
- func Sort(procs []collector.Proc, key SortKey, desc bool)
- type Signal
- type SortKey
- type TreeNode
Constants ¶
This section is empty.
Variables ¶
var Signals = []Signal{
{"TERM", "terminate"},
{"KILL", "force kill"},
{"INT", "interrupt"},
{"HUP", "hangup"},
{"QUIT", "quit + core"},
{"STOP", "pause"},
{"CONT", "resume"},
}
Signals lists the signals offered by the picker, in order. TERM and KILL mirror the classic terminate/force-kill shortcuts. On windows every entry except TERM and KILL is unavailable and the picker hides it.
Functions ¶
func Filter ¶
Filter keeps processes whose name or user contains needle (case-insensitive) or, when needle is all digits, whose PID starts with it.
func SendSignal ¶
SendSignal delivers the named signal to pid. TERM/KILL work on every platform (TerminateProcess on windows); the rest are unix-only.
func SignalIndex ¶
SignalIndex returns the position of name in Signals, or -1.
Types ¶
type Signal ¶
Signal is a signal wrongtop can deliver to a process.
func AvailableSignals ¶
func AvailableSignals() []Signal
AvailableSignals returns the signals this platform can deliver, in picker order.
type SortKey ¶
type SortKey int
SortKey selects the process table ordering.
type TreeNode ¶
TreeNode is one row of the flattened process forest: a process with its ancestry depth and whether it has children in the current set.
func BuildTree ¶
BuildTree orders processes depth-first by parentage for the tree view. Siblings (and parentless roots) sort with key/desc; processes whose parent is not in the set become roots; cycles — possible through PID reuse — are cut by emitting unvisited processes afterwards. Descendants of PIDs in collapsed are hidden.