| 333 | } |
| 334 | |
| 335 | func (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 | |
| 352 | func readFileAsUint64(path string) (uint64, error) { |
| 353 | data, err := ioutil.ReadFile(path) |