Merge pull request #3325 from kolyshkin/rm-go115

libct/cg: rm go 1.15 compatibility
This commit is contained in:
Akihiro Suda
2021-12-15 11:39:50 +09:00
committed by GitHub
2 changed files with 0 additions and 34 deletions
-3
View File
@@ -1,6 +1,3 @@
//go:build go1.16
// +build go1.16
package cgroups
import (
-31
View File
@@ -1,31 +0,0 @@
//go:build !go1.16
// +build !go1.16
package cgroups
import (
"os"
"path/filepath"
)
// GetAllPids returns all pids, that were added to cgroup at path and to all its
// subcgroups.
func GetAllPids(path string) ([]int, error) {
var pids []int
// collect pids from all sub-cgroups
err := filepath.Walk(path, func(p string, info os.FileInfo, iErr error) error {
if iErr != nil {
return iErr
}
if !info.IsDir() {
return nil
}
cPids, err := readProcsFile(p)
if err != nil {
return err
}
pids = append(pids, cPids...)
return nil
})
return pids, err
}