(context *cli.Context, action CtAct, criuOpts *libcontainer.CriuOpts)
| 365 | ) |
| 366 | |
| 367 | func startContainer(context *cli.Context, action CtAct, criuOpts *libcontainer.CriuOpts) (int, error) { |
| 368 | if err := revisePidFile(context); err != nil { |
| 369 | return -1, err |
| 370 | } |
| 371 | spec, err := setupSpec(context) |
| 372 | if err != nil { |
| 373 | return -1, err |
| 374 | } |
| 375 | |
| 376 | id := context.Args().First() |
| 377 | if id == "" { |
| 378 | return -1, errEmptyID |
| 379 | } |
| 380 | |
| 381 | notifySocket := newNotifySocket(context, os.Getenv("NOTIFY_SOCKET"), id) |
| 382 | if notifySocket != nil { |
| 383 | notifySocket.setupSpec(spec) |
| 384 | } |
| 385 | |
| 386 | container, err := createContainer(context, id, spec) |
| 387 | if err != nil { |
| 388 | return -1, err |
| 389 | } |
| 390 | |
| 391 | if notifySocket != nil { |
| 392 | if err := notifySocket.setupSocketDirectory(); err != nil { |
| 393 | return -1, err |
| 394 | } |
| 395 | if action == CT_ACT_RUN { |
| 396 | if err := notifySocket.bindSocket(); err != nil { |
| 397 | return -1, err |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | r := &runner{ |
| 403 | enableSubreaper: !context.Bool("no-subreaper"), |
| 404 | shouldDestroy: !context.Bool("keep"), |
| 405 | container: container, |
| 406 | listenFDs: activation.Files(), // On-demand socket activation. |
| 407 | notifySocket: notifySocket, |
| 408 | consoleSocket: context.String("console-socket"), |
| 409 | pidfdSocket: context.String("pidfd-socket"), |
| 410 | detach: context.Bool("detach"), |
| 411 | pidFile: context.String("pid-file"), |
| 412 | preserveFDs: context.Int("preserve-fds"), |
| 413 | action: action, |
| 414 | criuOpts: criuOpts, |
| 415 | init: true, |
| 416 | } |
| 417 | return r.run(spec.Process) |
| 418 | } |
| 419 | |
| 420 | func setupPidfdSocket(process *libcontainer.Process, sockpath string) (_clean func(), _ error) { |
| 421 | linux530 := kernelversion.KernelVersion{Kernel: 5, Major: 3} |
no test coverage detected
searching dependent graphs…