| 44 | } |
| 45 | |
| 46 | func (p *pidsController) Create(path string, resources *specs.LinuxResources) error { |
| 47 | if err := os.MkdirAll(p.Path(path), defaultDirPerm); err != nil { |
| 48 | return err |
| 49 | } |
| 50 | if resources.Pids != nil && resources.Pids.Limit != nil && |
| 51 | *resources.Pids.Limit > 0 { |
| 52 | return os.WriteFile( |
| 53 | filepath.Join(p.Path(path), "pids.max"), |
| 54 | []byte(strconv.FormatInt(*resources.Pids.Limit, 10)), |
| 55 | defaultFilePerm, |
| 56 | ) |
| 57 | } |
| 58 | return nil |
| 59 | } |
| 60 | |
| 61 | func (p *pidsController) Update(path string, resources *specs.LinuxResources) error { |
| 62 | return p.Create(path, resources) |