本文整理匯總了Golang中github.com/opencontainers/runc/libcontainer/cgroups.GetAllPids函數的典型用法代碼示例。如果您正苦於以下問題:Golang GetAllPids函數的具體用法?Golang GetAllPids怎麽用?Golang GetAllPids使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetAllPids函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetAllPids
func (m *Manager) GetAllPids() ([]int, error) {
path, err := getSubsystemPath(m.Cgroups, "devices")
if err != nil {
return nil, err
}
return cgroups.GetAllPids(path)
}
示例2: GetAllPids
func (m *Manager) GetAllPids() ([]int, error) {
dir, err := getCgroupPath(m.Cgroups)
if err != nil {
return nil, err
}
return cgroups.GetAllPids(dir)
}
示例3: killAllRemaining
func (stopper *CgroupStopper) killAllRemaining(signal syscall.Signal, cgroupPath string, exceptions []int) error {
pidsInCgroup, err := cgroups.GetAllPids(cgroupPath)
if err != nil {
return err
}
var pidsToKill []int
for _, pid := range pidsInCgroup {
if contains(exceptions, pid) {
continue
}
pidsToKill = append(pidsToKill, pid)
}
if len(pidsToKill) == 0 {
return nil
}
stopper.killer.Kill(signal, pidsToKill...)
return fmt.Errorf("still running after signal %s, %v", signal, pidsToKill)
}
示例4: GetAllPids
func (m *Manager) GetAllPids() ([]int, error) {
paths := m.GetPaths()
return cgroups.GetAllPids(paths["devices"])
}