// New returns the instance of a cgroup manager, which is chosen // based on the local environment (whether cgroup v1 or v2 is used) // and the config (whether config.Systemd is set or not). func New(config *configs.Cgroup) (cgroups.Manager, error) { … } // NewWithPaths is similar to New, and can be used in case cgroup paths // are already well known, which can save some resources. // // For cgroup v1, the keys are controller/subsystem name, and the values // are absolute filesystem paths to the appropriate cgroups. // // For cgroup v2, the only key allowed is "" (empty string), and the value // is the unified cgroup path. func NewWithPaths(config *configs.Cgroup, paths map[string]string) (cgroups.Manager, error) { … } // getUnifiedPath is an implementation detail of libcontainer. // Historically, libcontainer.Create saves cgroup paths as per-subsystem path // map (as returned by cm.GetPaths(""), but with v2 we only have one single // unified path (with "" as a key). // // This function converts from that map to string (using "" as a key), // and also checks that the map itself is sane. func getUnifiedPath(paths map[string]string) (string, error) { … }