Skip to content

Add support for listing the children of a process.

Choose a tag to compare

@pborman pborman released this 30 Aug 15:46
· 2 commits to main since this release

The Process structure now contains a Children []*Process field. This field is filled in by calling Process(true) or by using the new function GetProcessMap. Below is an example for fetching child information.

pm := ProcessMap()               // fetch all process information
p := pm.Pids[pid]                // get the Process structure for pid
childProcesses := p.Children     // p.Children is a slice of *Process
children := pm.GetChildren()     // get list of children's pids
dependents := pm.GetDecendents() // get list of all decendents pids