Merge pull request #5738 from thaJeztah/simplify_cgroup_add

Use cgroups.AddProc() for cgroups v1
This commit is contained in:
Akihiro Suda
2022-03-25 10:24:43 +09:00
committed by GitHub
4 changed files with 4 additions and 12 deletions

View File

@@ -35,9 +35,7 @@ func setCgroup(cgroupPath string, cmd *exec.Cmd) error {
if err != nil {
return fmt.Errorf("failed to load cgroup %s: %w", cgroupPath, err)
}
if err := cg.Add(cgroups.Process{
Pid: cmd.Process.Pid,
}); err != nil {
if err := cg.AddProc(uint64(cmd.Process.Pid)); err != nil {
return fmt.Errorf("failed to join cgroup %s: %w", cgroupPath, err)
}
return nil