MCPcopy
hub / github.com/opencontainers/runc / newSetnsProcess

Method newSetnsProcess

libcontainer/container_linux.go:654–678  ·  view source on GitHub ↗
(p *Process, cmd *exec.Cmd, comm *processComm)

Source from the content-addressed store, hash-verified

652}
653
654func (c *Container) newSetnsProcess(p *Process, cmd *exec.Cmd, comm *processComm) (*setnsProcess, error) {
655 cmd.Env = append(cmd.Env, "_LIBCONTAINER_INITTYPE="+string(initSetns))
656 state := c.currentState()
657 // for setns process, we don't have to set cloneflags as the process namespaces
658 // will only be set via setns syscall
659 data, err := c.bootstrapData(0, state.NamespacePaths)
660 if err != nil {
661 return nil, err
662 }
663 proc := &setnsProcess{
664 containerProcess: containerProcess{
665 cmd: cmd,
666 comm: comm,
667 manager: c.cgroupManager,
668 config: c.newInitConfig(p),
669 process: p,
670 bootstrapData: data,
671 container: c,
672 },
673 rootlessCgroups: c.config.RootlessCgroups,
674 intelRdtPath: state.IntelRdtPath,
675 initProcessPid: state.InitProcessPid,
676 }
677 return proc, nil
678}
679
680func (c *Container) newInitConfig(process *Process) *initConfig {
681 // Set initial properties. For those properties that exist

Callers 1

newParentProcessMethod · 0.95

Calls 3

currentStateMethod · 0.95
bootstrapDataMethod · 0.95
newInitConfigMethod · 0.95

Tested by

no test coverage detected