MCPcopy Create free account
hub / github.com/containers/common / createCgroupDirectory

Method createCgroupDirectory

pkg/cgroups/cgroups.go:335–350  ·  view source on GitHub ↗
(controller string)

Source from the content-addressed store, hash-verified

333}
334
335func (c *CgroupControl) createCgroupDirectory(controller string) (bool, error) {
336 cPath := c.getCgroupv1Path(controller)
337 _, err := os.Stat(cPath)
338 if err == nil {
339 return false, nil
340 }
341
342 if !os.IsNotExist(err) {
343 return false, err
344 }
345
346 if err := os.MkdirAll(cPath, 0755); err != nil {
347 return false, errors.Wrapf(err, "error creating cgroup for %s", controller)
348 }
349 return true, nil
350}
351
352func readFileAsUint64(path string) (uint64, error) {
353 data, err := ioutil.ReadFile(path)

Callers 5

CreateMethod · 0.80
CreateMethod · 0.80
CreateMethod · 0.80
CreateMethod · 0.80
CreateMethod · 0.80

Calls 2

getCgroupv1PathMethod · 0.95
StatMethod · 0.65

Tested by

no test coverage detected