mirror of
https://github.com/containers/podman.git
synced 2025-12-01 10:38:05 +08:00
vendor: update c/common
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
27
vendor/github.com/opencontainers/cgroups/getallpids.go
generated
vendored
Normal file
27
vendor/github.com/opencontainers/cgroups/getallpids.go
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
package cgroups
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// GetAllPids returns all pids from the cgroup identified by path, and all its
|
||||
// sub-cgroups.
|
||||
func GetAllPids(path string) ([]int, error) {
|
||||
var pids []int
|
||||
err := filepath.WalkDir(path, func(p string, d fs.DirEntry, iErr error) error {
|
||||
if iErr != nil {
|
||||
return iErr
|
||||
}
|
||||
if !d.IsDir() {
|
||||
return nil
|
||||
}
|
||||
cPids, err := readProcsFile(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pids = append(pids, cPids...)
|
||||
return nil
|
||||
})
|
||||
return pids, err
|
||||
}
|
||||
Reference in New Issue
Block a user