// SetupCgroups applies the cgroup restrictions to the process running in the contaienr based // on the container's configuration func SetupCgroups(container *libcontainer.Container, nspid int) (cgroups.ActiveCgroup, error) { if container.Cgroups != nil { c := container.Cgroups if systemd.UseSystemd() { return systemd.Apply(c, nspid) } return fs.Apply(c, nspid) } return nil, nil }
func (d *driver) Unpause(c *execdriver.Command) error { active := d.activeContainers[c.ID] if active == nil { return fmt.Errorf("active container for %s does not exist", c.ID) } active.container.Cgroups.Freezer = "THAWED" if systemd.UseSystemd() { return systemd.Freeze(active.container.Cgroups, active.container.Cgroups.Freezer) } return fs.Freeze(active.container.Cgroups, active.container.Cgroups.Freezer) }
func (d *driver) GetPidsForContainer(id string) ([]int, error) { active := d.activeContainers[id] if active == nil { return nil, fmt.Errorf("active container for %s does not exist", id) } c := active.container.Cgroups if systemd.UseSystemd() { return systemd.GetPids(c) } return fs.GetPids(c) }