From 1940c737774119269dc72f0e3e89adf33f7dbbda Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Mon, 5 Oct 2015 14:23:05 -0400 Subject: [PATCH 1/2] cgroups: Add a name cgroup This is meant to be used in retrieving the paths so an exec process enters all the cgroup paths correctly. Signed-off-by: Mrunal Patel --- libcontainer/cgroups/fs/name.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 libcontainer/cgroups/fs/name.go diff --git a/libcontainer/cgroups/fs/name.go b/libcontainer/cgroups/fs/name.go new file mode 100644 index 000000000..99913802c --- /dev/null +++ b/libcontainer/cgroups/fs/name.go @@ -0,0 +1,25 @@ +package fs + +import ( + "github.com/opencontainers/runc/libcontainer/cgroups" + "github.com/opencontainers/runc/libcontainer/configs" +) + +type NameGroup struct { +} + +func (s *NameGroup) Apply(d *data) error { + return nil +} + +func (s *NameGroup) Set(path string, cgroup *configs.Cgroup) error { + return nil +} + +func (s *NameGroup) Remove(d *data) error { + return nil +} + +func (s *NameGroup) GetStats(path string, stats *cgroups.Stats) error { + return nil +} From 79a02e35fbdfafe13f5ce842f3de1cf90553b2a1 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Mon, 5 Oct 2015 14:24:11 -0400 Subject: [PATCH 2/2] cgroups: Add name=systemd to list of subsystems This allows getting the path to the subsystem and so is subsequently used in EnterPid by an exec process. Signed-off-by: Mrunal Patel --- libcontainer/cgroups/systemd/apply_systemd.go | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libcontainer/cgroups/systemd/apply_systemd.go b/libcontainer/cgroups/systemd/apply_systemd.go index 205aca21e..c5cc8fc8f 100644 --- a/libcontainer/cgroups/systemd/apply_systemd.go +++ b/libcontainer/cgroups/systemd/apply_systemd.go @@ -34,17 +34,18 @@ type subsystem interface { } var subsystems = map[string]subsystem{ - "devices": &fs.DevicesGroup{}, - "memory": &fs.MemoryGroup{}, - "cpu": &fs.CpuGroup{}, - "cpuset": &fs.CpusetGroup{}, - "cpuacct": &fs.CpuacctGroup{}, - "blkio": &fs.BlkioGroup{}, - "hugetlb": &fs.HugetlbGroup{}, - "perf_event": &fs.PerfEventGroup{}, - "freezer": &fs.FreezerGroup{}, - "net_prio": &fs.NetPrioGroup{}, - "net_cls": &fs.NetClsGroup{}, + "devices": &fs.DevicesGroup{}, + "memory": &fs.MemoryGroup{}, + "cpu": &fs.CpuGroup{}, + "cpuset": &fs.CpusetGroup{}, + "cpuacct": &fs.CpuacctGroup{}, + "blkio": &fs.BlkioGroup{}, + "hugetlb": &fs.HugetlbGroup{}, + "perf_event": &fs.PerfEventGroup{}, + "freezer": &fs.FreezerGroup{}, + "net_prio": &fs.NetPrioGroup{}, + "net_cls": &fs.NetClsGroup{}, + "name=systemd": &fs.NameGroup{}, } const (