diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-01-11 05:39:12 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 05:39:12 -0800 |
commit | b3eb23d671425775673f86bd02b9c89ef781f590 (patch) | |
tree | 5f06e4e289f16d9164d692590a3fe6541b5384cf /vendor/github.com/containerd/cgroups/utils.go | |
parent | 26f2b7debde313af4a5ae39727c66a3f8fd59be4 (diff) | |
parent | bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87 (diff) | |
download | podman-b3eb23d671425775673f86bd02b9c89ef781f590.tar.gz podman-b3eb23d671425775673f86bd02b9c89ef781f590.tar.bz2 podman-b3eb23d671425775673f86bd02b9c89ef781f590.zip |
Merge pull request #2102 from vrothberg/vendor-update
vendor: update everything
Diffstat (limited to 'vendor/github.com/containerd/cgroups/utils.go')
-rw-r--r-- | vendor/github.com/containerd/cgroups/utils.go | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/vendor/github.com/containerd/cgroups/utils.go b/vendor/github.com/containerd/cgroups/utils.go index 345be4e46..f3129b1a3 100644 --- a/vendor/github.com/containerd/cgroups/utils.go +++ b/vendor/github.com/containerd/cgroups/utils.go @@ -111,7 +111,7 @@ func remove(path string) error { return fmt.Errorf("cgroups: unable to remove path %q", path) } -// readPids will read all the pids in a cgroup by the provided path +// readPids will read all the pids of processes in a cgroup by the provided path func readPids(path string, subsystem Name) ([]Process, error) { f, err := os.Open(filepath.Join(path, cgroupProcs)) if err != nil { @@ -138,6 +138,33 @@ func readPids(path string, subsystem Name) ([]Process, error) { return out, nil } +// readTasksPids will read all the pids of tasks in a cgroup by the provided path +func readTasksPids(path string, subsystem Name) ([]Task, error) { + f, err := os.Open(filepath.Join(path, cgroupTasks)) + if err != nil { + return nil, err + } + defer f.Close() + var ( + out []Task + s = bufio.NewScanner(f) + ) + for s.Scan() { + if t := s.Text(); t != "" { + pid, err := strconv.Atoi(t) + if err != nil { + return nil, err + } + out = append(out, Task{ + Pid: pid, + Subsystem: subsystem, + Path: path, + }) + } + } + return out, nil +} + func hugePageSizes() ([]string, error) { var ( pageSizes []string |