Skip to content

Commit

Permalink
Rename to InitPid
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
  • Loading branch information
Michael Crosby committed Jun 25, 2014
1 parent 77dcaac commit 5bb2501
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions namespaces/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion namespaces/execin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5bb2501

Please sign in to comment.