From ce9951834c84e79579628d4113697ba80e67fe3e Mon Sep 17 00:00:00 2001 From: Wang Long Date: Wed, 21 Sep 2016 10:53:52 +0000 Subject: [PATCH] cgroup: using WriteCgroupProc to write the specified pid into the cgroup's cgroup.procs file cgroupData.join method using `WriteCgroupProc` to place the pid into the proc file, it can avoid attach any pid to the cgroup if -1 is specified as a pid. so, replace `writeFile` with `WriteCgroupProc` like `cpuset.go`'s ApplyDir method. Signed-off-by: Wang Long --- libcontainer/cgroups/fs/cpu.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcontainer/cgroups/fs/cpu.go b/libcontainer/cgroups/fs/cpu.go index c941f95d..7cd506a8 100644 --- a/libcontainer/cgroups/fs/cpu.go +++ b/libcontainer/cgroups/fs/cpu.go @@ -46,7 +46,7 @@ func (s *CpuGroup) ApplyDir(path string, cgroup *configs.Cgroup, pid int) error } // because we are not using d.join we need to place the pid into the procs file // unlike the other subsystems - if err := writeFile(path, "cgroup.procs", strconv.Itoa(pid)); err != nil { + if err := cgroups.WriteCgroupProc(path, pid); err != nil { return err }