Add container start and supervisor

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-12-05 15:38:32 -08:00
parent e620833c9e
commit 21a53c1d70
11 changed files with 380 additions and 139 deletions

View file

@ -7,20 +7,26 @@ import (
"github.com/docker/containerd/execution"
)
func newProcess(pid int) (execution.Process, error) {
func newProcess(id string, pid int) (execution.Process, error) {
proc, err := os.FindProcess(pid)
if err != nil {
return nil, err
}
return &process{
id: id,
proc: proc,
}, nil
}
type process struct {
id string
proc *os.Process
}
func (p *process) ID() string {
return p.id
}
func (p *process) Pid() int {
return p.proc.Pid
}
@ -30,6 +36,7 @@ func (p *process) Wait() (uint32, error) {
if err != nil {
return 0, nil
}
// TODO: implement kill-all if we are the init pid
return uint32(state.Sys().(syscall.WaitStatus).ExitStatus()), nil
}