Rename to InitPid
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
This commit is contained in:
parent
77dcaac129
commit
5bb250143e
|
@ -58,8 +58,8 @@ func Exec(container *libcontainer.Config, term Terminal, rootfs, dataPath string
|
|||
}
|
||||
|
||||
state := &libcontainer.State{
|
||||
Pid1: command.Process.Pid,
|
||||
Pid1StartTime: started,
|
||||
InitPid: command.Process.Pid,
|
||||
InitStartTime: started,
|
||||
}
|
||||
|
||||
if err := libcontainer.SaveState(dataPath, state); err != nil {
|
||||
|
|
|
@ -22,7 +22,7 @@ func ExecIn(container *libcontainer.Config, state *libcontainer.State, args []st
|
|||
}
|
||||
|
||||
// Enter the namespace and then finish setup
|
||||
finalArgs := []string{os.Args[0], "nsenter", "--nspid", strconv.Itoa(state.Pid1), "--containerjson", string(containerJson), "--"}
|
||||
finalArgs := []string{os.Args[0], "nsenter", "--nspid", strconv.Itoa(state.InitPid), "--containerjson", string(containerJson), "--"}
|
||||
finalArgs = append(finalArgs, args...)
|
||||
if err := system.Execv(finalArgs[0], finalArgs[0:], os.Environ()); err != nil {
|
||||
return err
|
||||
|
|
8
state.go
8
state.go
|
@ -8,10 +8,10 @@ import (
|
|||
|
||||
// State represents a running container's state
|
||||
type State struct {
|
||||
// Pid1 is the process id for the container's pid 1 in it's parent namespace
|
||||
Pid1 int `json:"pid1,omitempty"`
|
||||
// Pid1StartTime is the process start time for the container's pid 1
|
||||
Pid1StartTime string `json:"pid1_start_time,omitempty"`
|
||||
// InitPid is the init process id in the parent namespace
|
||||
InitPid int `json:"init_pid,omitempty"`
|
||||
// InitStartTime is the init process start time
|
||||
InitStartTime string `json:"init_start_time,omitempty"`
|
||||
}
|
||||
|
||||
// SaveState writes the container's runtime state to a state.json file
|
||||
|
|
Loading…
Reference in New Issue