()
| 240 | } |
| 241 | |
| 242 | func (p *setnsProcess) setFinalCPUAffinity() error { |
| 243 | aff := p.config.CPUAffinity |
| 244 | // If there was no affinity configured at all, we want to reset |
| 245 | // the affinity to make sure we don't inherit an unexpected one. |
| 246 | if aff == nil || aff.Final == nil && aff.Initial == nil { |
| 247 | tryResetCPUAffinity(p.pid()) |
| 248 | return nil |
| 249 | } |
| 250 | if aff.Final == nil { |
| 251 | return nil |
| 252 | } |
| 253 | if err := unix.SchedSetaffinity(p.pid(), aff.Final); err != nil { |
| 254 | return fmt.Errorf("error setting final CPU affinity: %w", err) |
| 255 | } |
| 256 | return nil |
| 257 | } |
| 258 | |
| 259 | func (p *setnsProcess) addIntoCgroupV1() error { |
| 260 | if sub, ok := p.process.SubCgroupPaths[""]; ok || len(p.process.SubCgroupPaths) == 0 { |
no test coverage detected