(process *Process)
| 678 | } |
| 679 | |
| 680 | func (c *Container) newInitConfig(process *Process) *initConfig { |
| 681 | // Set initial properties. For those properties that exist |
| 682 | // both in the container config and the process, use the ones |
| 683 | // from the container config first, and override them later. |
| 684 | cfg := &initConfig{ |
| 685 | Config: c.config, |
| 686 | Args: process.Args, |
| 687 | Env: process.Env, |
| 688 | UID: process.UID, |
| 689 | GID: process.GID, |
| 690 | AdditionalGroups: process.AdditionalGroups, |
| 691 | Cwd: process.Cwd, |
| 692 | Capabilities: c.config.Capabilities, |
| 693 | PassedFilesCount: len(process.ExtraFiles), |
| 694 | ContainerID: c.ID(), |
| 695 | NoNewPrivileges: c.config.NoNewPrivileges, |
| 696 | AppArmorProfile: c.config.AppArmorProfile, |
| 697 | ProcessLabel: c.config.ProcessLabel, |
| 698 | Rlimits: c.config.Rlimits, |
| 699 | IOPriority: c.config.IOPriority, |
| 700 | Scheduler: c.config.Scheduler, |
| 701 | CPUAffinity: c.config.ExecCPUAffinity, |
| 702 | CreateConsole: process.ConsoleSocket != nil, |
| 703 | ConsoleWidth: process.ConsoleWidth, |
| 704 | ConsoleHeight: process.ConsoleHeight, |
| 705 | } |
| 706 | |
| 707 | // Overwrite config properties with ones from process. |
| 708 | |
| 709 | if process.Capabilities != nil { |
| 710 | cfg.Capabilities = process.Capabilities |
| 711 | } |
| 712 | if process.NoNewPrivileges != nil { |
| 713 | cfg.NoNewPrivileges = *process.NoNewPrivileges |
| 714 | } |
| 715 | if process.AppArmorProfile != "" { |
| 716 | cfg.AppArmorProfile = process.AppArmorProfile |
| 717 | } |
| 718 | if process.Label != "" { |
| 719 | cfg.ProcessLabel = process.Label |
| 720 | } |
| 721 | if len(process.Rlimits) > 0 { |
| 722 | cfg.Rlimits = process.Rlimits |
| 723 | } |
| 724 | if process.IOPriority != nil { |
| 725 | cfg.IOPriority = process.IOPriority |
| 726 | } |
| 727 | if process.Scheduler != nil { |
| 728 | cfg.Scheduler = process.Scheduler |
| 729 | } |
| 730 | if process.CPUAffinity != nil { |
| 731 | cfg.CPUAffinity = process.CPUAffinity |
| 732 | } |
| 733 | |
| 734 | // Set misc properties. |
| 735 | |
| 736 | if cgroups.IsCgroup2UnifiedMode() { |
| 737 | cfg.Cgroup2Path = c.cgroupManager.Path("") |
no test coverage detected