Files
podman/vendor/github.com/opencontainers/cgroups/fs2/cpuset.go
Giuseppe Scrivano 88b62d2c27 vendor: update c/common
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-03-20 13:37:19 +01:00

28 lines
530 B
Go

package fs2
import (
"github.com/opencontainers/cgroups"
)
func isCpusetSet(r *cgroups.Resources) bool {
return r.CpusetCpus != "" || r.CpusetMems != ""
}
func setCpuset(dirPath string, r *cgroups.Resources) error {
if !isCpusetSet(r) {
return nil
}
if r.CpusetCpus != "" {
if err := cgroups.WriteFile(dirPath, "cpuset.cpus", r.CpusetCpus); err != nil {
return err
}
}
if r.CpusetMems != "" {
if err := cgroups.WriteFile(dirPath, "cpuset.mems", r.CpusetMems); err != nil {
return err
}
}
return nil
}