diff --git a/libcontainer/cgroups/fs/apply_raw.go b/libcontainer/cgroups/fs/apply_raw.go index a0a93a4a..e597d43e 100644 --- a/libcontainer/cgroups/fs/apply_raw.go +++ b/libcontainer/cgroups/fs/apply_raw.go @@ -34,6 +34,8 @@ var ( ) type subsystem interface { + // Name returns the name of the subsystem. + Name() string // Returns the stats, as 'stats', corresponding to the cgroup under 'path'. GetStats(path string, stats *cgroups.Stats) error // Removes the cgroup represented by 'data'. diff --git a/libcontainer/cgroups/fs/blkio.go b/libcontainer/cgroups/fs/blkio.go index db886bcf..0cb65cb9 100644 --- a/libcontainer/cgroups/fs/blkio.go +++ b/libcontainer/cgroups/fs/blkio.go @@ -17,6 +17,10 @@ import ( type BlkioGroup struct { } +func (s *BlkioGroup) Name() string { + return "blkio" +} + func (s *BlkioGroup) Apply(d *data) error { dir, err := d.join("blkio") if err != nil && !cgroups.IsNotFound(err) { diff --git a/libcontainer/cgroups/fs/cpu.go b/libcontainer/cgroups/fs/cpu.go index 5afd5b8d..5161a7a6 100644 --- a/libcontainer/cgroups/fs/cpu.go +++ b/libcontainer/cgroups/fs/cpu.go @@ -15,6 +15,10 @@ import ( type CpuGroup struct { } +func (s *CpuGroup) Name() string { + return "cpu" +} + func (s *CpuGroup) Apply(d *data) error { // We always want to join the cpu group, to allow fair cpu scheduling // on a container basis diff --git a/libcontainer/cgroups/fs/cpuacct.go b/libcontainer/cgroups/fs/cpuacct.go index 4ff4fefe..c855fb32 100644 --- a/libcontainer/cgroups/fs/cpuacct.go +++ b/libcontainer/cgroups/fs/cpuacct.go @@ -24,6 +24,10 @@ var clockTicks = uint64(system.GetClockTicks()) type CpuacctGroup struct { } +func (s *CpuacctGroup) Name() string { + return "cpuacct" +} + func (s *CpuacctGroup) Apply(d *data) error { // we just want to join this group even though we don't set anything if _, err := d.join("cpuacct"); err != nil && !cgroups.IsNotFound(err) { diff --git a/libcontainer/cgroups/fs/cpuset.go b/libcontainer/cgroups/fs/cpuset.go index 9c603be6..19c27bde 100644 --- a/libcontainer/cgroups/fs/cpuset.go +++ b/libcontainer/cgroups/fs/cpuset.go @@ -16,6 +16,10 @@ import ( type CpusetGroup struct { } +func (s *CpusetGroup) Name() string { + return "cpuset" +} + func (s *CpusetGroup) Apply(d *data) error { dir, err := d.path("cpuset") if err != nil && !cgroups.IsNotFound(err) { diff --git a/libcontainer/cgroups/fs/devices.go b/libcontainer/cgroups/fs/devices.go index d621d275..dfd20601 100644 --- a/libcontainer/cgroups/fs/devices.go +++ b/libcontainer/cgroups/fs/devices.go @@ -10,6 +10,10 @@ import ( type DevicesGroup struct { } +func (s *DevicesGroup) Name() string { + return "devices" +} + func (s *DevicesGroup) Apply(d *data) error { dir, err := d.join("devices") if err != nil { diff --git a/libcontainer/cgroups/fs/freezer.go b/libcontainer/cgroups/fs/freezer.go index 47f74395..b6df93ea 100644 --- a/libcontainer/cgroups/fs/freezer.go +++ b/libcontainer/cgroups/fs/freezer.go @@ -14,6 +14,10 @@ import ( type FreezerGroup struct { } +func (s *FreezerGroup) Name() string { + return "freezer" +} + func (s *FreezerGroup) Apply(d *data) error { dir, err := d.join("freezer") if err != nil && !cgroups.IsNotFound(err) { diff --git a/libcontainer/cgroups/fs/hugetlb.go b/libcontainer/cgroups/fs/hugetlb.go index a7d3a870..1c2f7f78 100644 --- a/libcontainer/cgroups/fs/hugetlb.go +++ b/libcontainer/cgroups/fs/hugetlb.go @@ -14,6 +14,10 @@ import ( type HugetlbGroup struct { } +func (s *HugetlbGroup) Name() string { + return "hugetlb" +} + func (s *HugetlbGroup) Apply(d *data) error { dir, err := d.join("hugetlb") if err != nil && !cgroups.IsNotFound(err) { diff --git a/libcontainer/cgroups/fs/memory.go b/libcontainer/cgroups/fs/memory.go index 23c68f83..19dfcc72 100644 --- a/libcontainer/cgroups/fs/memory.go +++ b/libcontainer/cgroups/fs/memory.go @@ -17,6 +17,10 @@ import ( type MemoryGroup struct { } +func (s *MemoryGroup) Name() string { + return "memory" +} + func (s *MemoryGroup) Apply(d *data) (err error) { path, err := d.path("memory") if err != nil { diff --git a/libcontainer/cgroups/fs/net_cls.go b/libcontainer/cgroups/fs/net_cls.go index 23335dd7..abee87c9 100644 --- a/libcontainer/cgroups/fs/net_cls.go +++ b/libcontainer/cgroups/fs/net_cls.go @@ -8,6 +8,10 @@ import ( type NetClsGroup struct { } +func (s *NetClsGroup) Name() string { + return "net_cls" +} + func (s *NetClsGroup) Apply(d *data) error { dir, err := d.join("net_cls") if err != nil && !cgroups.IsNotFound(err) { diff --git a/libcontainer/cgroups/fs/net_prio.go b/libcontainer/cgroups/fs/net_prio.go index 88f2ea8b..54edcfc7 100644 --- a/libcontainer/cgroups/fs/net_prio.go +++ b/libcontainer/cgroups/fs/net_prio.go @@ -8,6 +8,10 @@ import ( type NetPrioGroup struct { } +func (s *NetPrioGroup) Name() string { + return "net_prio" +} + func (s *NetPrioGroup) Apply(d *data) error { dir, err := d.join("net_prio") if err != nil && !cgroups.IsNotFound(err) { diff --git a/libcontainer/cgroups/fs/perf_event.go b/libcontainer/cgroups/fs/perf_event.go index 30be9e56..7bcb8df8 100644 --- a/libcontainer/cgroups/fs/perf_event.go +++ b/libcontainer/cgroups/fs/perf_event.go @@ -10,6 +10,10 @@ import ( type PerfEventGroup struct { } +func (s *PerfEventGroup) Name() string { + return "perf_event" +} + func (s *PerfEventGroup) Apply(d *data) error { // we just want to join this group even though we don't set anything if _, err := d.join("perf_event"); err != nil && !cgroups.IsNotFound(err) {