github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/mergeCode/runc/libcontainer/cgroups/fs/name.go (about)

     1  // +build linux
     2  
     3  package fs
     4  
     5  import (
     6  	"github.com/opencontainers/runc/libcontainer/cgroups"
     7  	"github.com/opencontainers/runc/libcontainer/configs"
     8  )
     9  
    10  type NameGroup struct {
    11  	GroupName string
    12  	Join      bool
    13  }
    14  
    15  func (s *NameGroup) Name() string {
    16  	return s.GroupName
    17  }
    18  
    19  func (s *NameGroup) Apply(d *cgroupData) error {
    20  	if s.Join {
    21  		// ignore errors if the named cgroup does not exist
    22  		d.join(s.GroupName)
    23  	}
    24  	return nil
    25  }
    26  
    27  func (s *NameGroup) Set(path string, cgroup *configs.Cgroup) error {
    28  	return nil
    29  }
    30  
    31  func (s *NameGroup) Remove(d *cgroupData) error {
    32  	if s.Join {
    33  		removePath(d.path(s.GroupName))
    34  	}
    35  	return nil
    36  }
    37  
    38  func (s *NameGroup) GetStats(path string, stats *cgroups.Stats) error {
    39  	return nil
    40  }