diff --git a/libcontainer/cgroups/fs2/fs2.go b/libcontainer/cgroups/fs2/fs2.go index 8697e3c7..4ab291b1 100644 --- a/libcontainer/cgroups/fs2/fs2.go +++ b/libcontainer/cgroups/fs2/fs2.go @@ -13,6 +13,16 @@ import ( "github.com/pkg/errors" ) +type manager struct { + config *configs.Cgroup + // dirPath is like "/sys/fs/cgroup/user.slice/user-1001.slice/session-1.scope" + dirPath string + // controllers is content of "cgroup.controllers" file. + // excludes pseudo-controllers ("devices" and "freezer"). + controllers map[string]struct{} + rootless bool +} + // NewManager creates a manager for cgroup v2 unified hierarchy. // dirPath is like "/sys/fs/cgroup/user.slice/user-1001.slice/session-1.scope". // If dirPath is empty, it is automatically set using config. @@ -62,16 +72,6 @@ func detectControllers(dirPath string) (map[string]struct{}, error) { return controllers, nil } -type manager struct { - config *configs.Cgroup - // dirPath is like "/sys/fs/cgroup/user.slice/user-1001.slice/session-1.scope" - dirPath string - // controllers is content of "cgroup.controllers" file. - // excludes pseudo-controllers ("devices" and "freezer"). - controllers map[string]struct{} - rootless bool -} - func (m *manager) Apply(pid int) error { if err := cgroups.WriteCgroupProc(m.dirPath, pid); err != nil && !m.rootless { return err