(name string, resources *Resources)
| 373 | } |
| 374 | |
| 375 | func (c *Manager) NewChild(name string, resources *Resources) (*Manager, error) { |
| 376 | if strings.HasPrefix(name, "/") { |
| 377 | return nil, errors.New("name must be relative") |
| 378 | } |
| 379 | path := filepath.Join(c.path, name) |
| 380 | if err := os.MkdirAll(path, defaultDirPerm); err != nil { |
| 381 | return nil, err |
| 382 | } |
| 383 | m := Manager{ |
| 384 | unifiedMountpoint: c.unifiedMountpoint, |
| 385 | path: path, |
| 386 | } |
| 387 | if resources != nil { |
| 388 | if err := m.ToggleControllers(resources.EnabledControllers(), Enable); err != nil { |
| 389 | // clean up cgroup dir on failure |
| 390 | os.Remove(path) |
| 391 | return nil, err |
| 392 | } |
| 393 | } |
| 394 | if err := setResources(path, resources); err != nil { |
| 395 | // clean up cgroup dir on failure |
| 396 | os.Remove(path) |
| 397 | return nil, err |
| 398 | } |
| 399 | return &m, nil |
| 400 | } |
| 401 | |
| 402 | func (c *Manager) AddProc(pid uint64) error { |
| 403 | v := Value{ |
nothing calls this directly
no test coverage detected