2015-10-24 04:41:10 +08:00
|
|
|
// +build linux
|
|
|
|
|
2015-10-06 02:23:05 +08:00
|
|
|
package fs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/opencontainers/runc/libcontainer/cgroups"
|
|
|
|
"github.com/opencontainers/runc/libcontainer/configs"
|
|
|
|
)
|
|
|
|
|
|
|
|
type NameGroup struct {
|
2015-10-17 02:32:19 +08:00
|
|
|
GroupName string
|
2016-02-20 03:23:30 +08:00
|
|
|
Join bool
|
2015-10-17 02:32:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *NameGroup) Name() string {
|
|
|
|
return s.GroupName
|
2015-10-06 02:23:05 +08:00
|
|
|
}
|
|
|
|
|
2015-11-05 18:41:08 +08:00
|
|
|
func (s *NameGroup) Apply(d *cgroupData) error {
|
2016-02-20 03:23:30 +08:00
|
|
|
if s.Join {
|
|
|
|
// ignore errors if the named cgroup does not exist
|
|
|
|
d.join(s.GroupName)
|
|
|
|
}
|
2015-10-06 02:23:05 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *NameGroup) Set(path string, cgroup *configs.Cgroup) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-11-05 18:41:08 +08:00
|
|
|
func (s *NameGroup) Remove(d *cgroupData) error {
|
2016-02-20 03:23:30 +08:00
|
|
|
if s.Join {
|
|
|
|
removePath(d.path(s.GroupName))
|
|
|
|
}
|
2015-10-06 02:23:05 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *NameGroup) GetStats(path string, stats *cgroups.Stats) error {
|
|
|
|
return nil
|
|
|
|
}
|