(process Process, pType procType, subsystems ...Name)
| 222 | } |
| 223 | |
| 224 | func (c *cgroup) add(process Process, pType procType, subsystems ...Name) error { |
| 225 | if process.Pid <= 0 { |
| 226 | return ErrInvalidPid |
| 227 | } |
| 228 | c.mu.Lock() |
| 229 | defer c.mu.Unlock() |
| 230 | if c.err != nil { |
| 231 | return c.err |
| 232 | } |
| 233 | for _, s := range pathers(c.subsystemsFilter(subsystems...)) { |
| 234 | p, err := c.path(s.Name()) |
| 235 | if err != nil { |
| 236 | return err |
| 237 | } |
| 238 | err = writeCgroupProcs( |
| 239 | filepath.Join(s.Path(p), pType), |
| 240 | []byte(strconv.Itoa(process.Pid)), |
| 241 | defaultFilePerm, |
| 242 | ) |
| 243 | if err != nil { |
| 244 | return err |
| 245 | } |
| 246 | } |
| 247 | return nil |
| 248 | } |
| 249 | |
| 250 | // Delete will remove the control group from each of the subsystems registered |
| 251 | func (c *cgroup) Delete() error { |
no test coverage detected