MCPcopy Create free account
hub / github.com/containerd/cgroups / NewManager

Function NewManager

cgroup2/manager.go:190–215  ·  view source on GitHub ↗
(mountpoint string, group string, resources *Resources)

Source from the content-addressed store, hash-verified

188}
189
190func NewManager(mountpoint string, group string, resources *Resources) (*Manager, error) {
191 if resources == nil {
192 return nil, errors.New("resources reference is nil")
193 }
194 if err := VerifyGroupPath(group); err != nil {
195 return nil, err
196 }
197 path := filepath.Join(mountpoint, group)
198 if err := os.MkdirAll(path, defaultDirPerm); err != nil {
199 return nil, err
200 }
201 m := Manager{
202 unifiedMountpoint: mountpoint,
203 path: path,
204 }
205 if err := m.ToggleControllers(resources.EnabledControllers(), Enable); err != nil {
206 // clean up cgroup dir on failure
207 os.Remove(path)
208 return nil, err
209 }
210 if err := setResources(path, resources); err != nil {
211 os.Remove(path)
212 return nil, err
213 }
214 return &m, nil
215}
216
217type InitConfig struct {
218 mountpoint string

Callers 14

main.goFile · 0.92
TestCgroupv2CpuStatsFunction · 0.85
TestCgroupv2PidsStatsFunction · 0.85
TestKillFunction · 0.85
TestMoveToFunction · 0.85
TestCgroupTypeFunction · 0.85
TestCgroupv2PSIStatsFunction · 0.85
BenchmarkStatFunction · 0.85
TestStatFilteredFunction · 0.85
BenchmarkStatFilteredFunction · 0.85
TestCgroupv2IOControllerFunction · 0.85

Calls 5

ToggleControllersMethod · 0.95
VerifyGroupPathFunction · 0.85
setResourcesFunction · 0.85
EnabledControllersMethod · 0.80
NewMethod · 0.65

Tested by 13

TestCgroupv2CpuStatsFunction · 0.68
TestCgroupv2PidsStatsFunction · 0.68
TestKillFunction · 0.68
TestMoveToFunction · 0.68
TestCgroupTypeFunction · 0.68
TestCgroupv2PSIStatsFunction · 0.68
BenchmarkStatFunction · 0.68
TestStatFilteredFunction · 0.68
BenchmarkStatFilteredFunction · 0.68
TestCgroupv2IOControllerFunction · 0.68
TestCgroupv2HugetlbStatsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…