示例#1
0
文件: cgutil.go 项目: beginnor/docker
func getPids(config *cgroups.Cgroup) []int {
	pids, err := fs.GetPids(config)
	if err != nil {
		log.Fatal(err)
	}
	return pids
}
示例#2
0
文件: cgutil.go 项目: beginnor/docker
func psAction(context *cli.Context) {
	config, err := getConfig(context)
	if err != nil {
		log.Fatal(err)
	}

	pids, err := fs.GetPids(config)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Pids in '%s':\n", config.Name)
	fmt.Println(pids)
}
示例#3
0
文件: driver.go 项目: beginnor/docker
func (d *driver) GetPidsForContainer(id string) ([]int, error) {
	d.Lock()
	active := d.activeContainers[id]
	d.Unlock()

	if active == nil {
		return nil, fmt.Errorf("active container for %s does not exist", id)
	}
	c := active.container.Cgroups

	if systemd.UseSystemd() {
		return systemd.GetPids(c)
	}
	return fs.GetPids(c)
}