mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
88e8350de2
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd/cgroups#109 Fix #2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
23 lines
556 B
Go
23 lines
556 B
Go
// +build linux
|
|
|
|
package fs2
|
|
|
|
import (
|
|
"github.com/opencontainers/runc/libcontainer/cgroups/fscommon"
|
|
"github.com/opencontainers/runc/libcontainer/configs"
|
|
)
|
|
|
|
func setCpuset(dirPath string, cgroup *configs.Cgroup) error {
|
|
if cgroup.Resources.CpusetCpus != "" {
|
|
if err := fscommon.WriteFile(dirPath, "cpuset.cpus", cgroup.Resources.CpusetCpus); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
if cgroup.Resources.CpusetMems != "" {
|
|
if err := fscommon.WriteFile(dirPath, "cpuset.mems", cgroup.Resources.CpusetMems); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|