(process *libcontainer.Process, sockpath string)
| 418 | } |
| 419 | |
| 420 | func setupPidfdSocket(process *libcontainer.Process, sockpath string) (_clean func(), _ error) { |
| 421 | linux530 := kernelversion.KernelVersion{Kernel: 5, Major: 3} |
| 422 | ok, err := kernelversion.GreaterEqualThan(linux530) |
| 423 | if err != nil { |
| 424 | return nil, err |
| 425 | } |
| 426 | if !ok { |
| 427 | return nil, fmt.Errorf("--pidfd-socket requires >= v5.3 kernel") |
| 428 | } |
| 429 | |
| 430 | conn, err := net.Dial("unix", sockpath) |
| 431 | if err != nil { |
| 432 | return nil, fmt.Errorf("failed to dail %s: %w", sockpath, err) |
| 433 | } |
| 434 | |
| 435 | socket, err := conn.(*net.UnixConn).File() |
| 436 | if err != nil { |
| 437 | conn.Close() |
| 438 | return nil, fmt.Errorf("failed to dup socket: %w", err) |
| 439 | } |
| 440 | |
| 441 | process.PidfdSocket = socket |
| 442 | return func() { |
| 443 | conn.Close() |
| 444 | }, nil |
| 445 | } |
| 446 | |
| 447 | func maybeLogCgroupWarning(op string, err error) { |
| 448 | if errors.Is(err, fs.ErrPermission) { |
no test coverage detected
searching dependent graphs…