libpod: split out cgroups call into linux specific file

So that we do not cause compile error on freebsd.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-12-05 17:49:10 +01:00
parent 32c25c6026
commit 03d411abc0
3 changed files with 9 additions and 2 deletions

View File

@ -23,7 +23,6 @@ import (
"text/template" "text/template"
"time" "time"
"github.com/containers/common/pkg/cgroups"
"github.com/containers/common/pkg/config" "github.com/containers/common/pkg/config"
"github.com/containers/common/pkg/detach" "github.com/containers/common/pkg/detach"
"github.com/containers/common/pkg/resize" "github.com/containers/common/pkg/resize"
@ -1100,7 +1099,7 @@ func (r *ConmonOCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Co
} }
if ctr.config.CgroupsMode == cgroupSplit { if ctr.config.CgroupsMode == cgroupSplit {
if err := cgroups.MoveUnderCgroupSubtree("runtime"); err != nil { if err := moveToRuntimeCgroup(); err != nil {
return 0, err return 0, err
} }
} }

View File

@ -28,3 +28,7 @@ func (r *ConmonOCIRuntime) moveConmonToCgroupAndSignal(ctr *Container, cmd *exec
} }
return nil return nil
} }
func moveToRuntimeCgroup() error {
return errors.New("moveToRuntimeCgroup not supported on freebsd")
}

View File

@ -326,3 +326,7 @@ func GetLimits(resource *spec.LinuxResources) (runcconfig.Resources, error) {
final.Unified = resource.Unified final.Unified = resource.Unified
return *final, nil return *final, nil
} }
func moveToRuntimeCgroup() error {
return cgroups.MoveUnderCgroupSubtree("runtime")
}