Files
docker-cli/components/engine/execdriver/driver.go
Michael Crosby 653b7f7ad7 Improve chroot driver by mounting proc
Add -driver flag to dockerinit

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 92e6db7beba8ad58e425119cc9885c355a5755e7
Component: engine
2014-01-17 17:42:22 -08:00

55 lines
1.1 KiB
Go

package execdriver
import (
"os/exec"
"syscall"
"time"
)
type Driver interface {
Start(c *Process) error
Kill(c *Process, sig int) error
Wait(id string, duration time.Duration) error // Wait on an out of process option - lxc ghosts
Version() string
String() string
}
// Network settings of the container
type Network struct {
Gateway string
IPAddress string
IPPrefixLen int
Mtu int
}
// Process wrapps an os/exec.Cmd to add more metadata
type Process struct {
exec.Cmd
ID string
Privileged bool
User string
Rootfs string // root fs of the container
InitPath string // dockerinit
Entrypoint string
Arguments []string
WorkingDir string
ConfigPath string
Tty bool
Network *Network // if network is nil then networking is disabled
SysInitPath string
WaitLock chan struct{}
WaitError error
}
func (c *Process) Pid() int {
return c.Process.Pid
}
func (c *Process) GetExitCode() int {
if c.ProcessState == nil {
return -1
}
return c.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
}