diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index 13be71ccb89..ab373af272a 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -653,14 +653,16 @@ func (c *Container) newInitProcess(p *Process, cmd *exec.Cmd, comm *processComm) } init := &initProcess{ - cmd: cmd, - comm: comm, - manager: c.cgroupManager, + containerProcess: containerProcess{ + cmd: cmd, + comm: comm, + manager: c.cgroupManager, + config: c.newInitConfig(p), + process: p, + bootstrapData: data, + container: c, + }, intelRdtManager: c.intelRdtManager, - config: c.newInitConfig(p), - container: c, - process: p, - bootstrapData: data, } c.initProcess = init return init, nil @@ -679,15 +681,18 @@ func (c *Container) newSetnsProcess(p *Process, cmd *exec.Cmd, comm *processComm return nil, err } proc := &setnsProcess{ - cmd: cmd, + containerProcess: containerProcess{ + cmd: cmd, + comm: comm, + manager: c.cgroupManager, + config: c.newInitConfig(p), + process: p, + bootstrapData: data, + container: c, + }, cgroupPaths: state.CgroupPaths, rootlessCgroups: c.config.RootlessCgroups, intelRdtPath: state.IntelRdtPath, - comm: comm, - manager: c.cgroupManager, - config: c.newInitConfig(p), - process: p, - bootstrapData: data, initProcessPid: state.InitProcessPid, } if len(p.SubCgroupPaths) > 0 { diff --git a/libcontainer/process_linux.go b/libcontainer/process_linux.go index be824962640..1ba63148f9e 100644 --- a/libcontainer/process_linux.go +++ b/libcontainer/process_linux.go @@ -99,17 +99,22 @@ func (c *processComm) closeParent() { // c.logPipeParent is kept alive for ForwardLogs } +type containerProcess struct { + cmd *exec.Cmd + comm *processComm + config *initConfig + manager cgroups.Manager + fds []string + process *Process + bootstrapData io.Reader + container *Container +} + type setnsProcess struct { - cmd *exec.Cmd - comm *processComm + containerProcess cgroupPaths map[string]string rootlessCgroups bool - manager cgroups.Manager intelRdtPath string - config *initConfig - fds []string - process *Process - bootstrapData io.Reader initProcessPid int } @@ -430,15 +435,8 @@ func (p *setnsProcess) forwardChildLogs() chan error { } type initProcess struct { - cmd *exec.Cmd - comm *processComm - config *initConfig - manager cgroups.Manager + containerProcess intelRdtManager *intelrdt.Manager - container *Container - fds []string - process *Process - bootstrapData io.Reader } func (p *initProcess) pid() int { diff --git a/libcontainer/process_linux_test.go b/libcontainer/setns_process_linux_test.go similarity index 100% rename from libcontainer/process_linux_test.go rename to libcontainer/setns_process_linux_test.go