Windows: Fix docker info not to SIGSEGV

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2015-07-09 16:37:54 -07:00
parent e64af7a70e
commit 4348ad68f8

View file

@ -62,16 +62,11 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
Images: imgcount,
Driver: daemon.GraphDriver().String(),
DriverStatus: daemon.GraphDriver().Status(),
MemoryLimit: daemon.SystemConfig().MemoryLimit,
SwapLimit: daemon.SystemConfig().SwapLimit,
CpuCfsPeriod: daemon.SystemConfig().CpuCfsPeriod,
CpuCfsQuota: daemon.SystemConfig().CpuCfsQuota,
IPv4Forwarding: !daemon.SystemConfig().IPv4ForwardingDisabled,
BridgeNfIptables: !daemon.SystemConfig().BridgeNfCallIptablesDisabled,
BridgeNfIp6tables: !daemon.SystemConfig().BridgeNfCallIp6tablesDisabled,
Debug: os.Getenv("DEBUG") != "",
NFd: fileutils.GetTotalUsedFds(),
OomKillDisable: daemon.SystemConfig().OomKillDisable,
NGoroutines: runtime.NumGoroutine(),
SystemTime: time.Now().Format(time.RFC3339Nano),
ExecutionDriver: daemon.ExecutionDriver().Name(),
@ -90,6 +85,18 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
ExperimentalBuild: utils.ExperimentalBuild(),
}
// TODO Windows. Refactor this more once sysinfo is refactored into
// platform specific code. On Windows, sysinfo.cgroupMemInfo and
// sysinfo.cgroupCpuInfo will be nil otherwise and cause a SIGSEGV if
// an attempt is made to access through them.
if runtime.GOOS != "windows" {
v.MemoryLimit = daemon.SystemConfig().MemoryLimit
v.SwapLimit = daemon.SystemConfig().SwapLimit
v.OomKillDisable = daemon.SystemConfig().OomKillDisable
v.CpuCfsPeriod = daemon.SystemConfig().CpuCfsPeriod
v.CpuCfsQuota = daemon.SystemConfig().CpuCfsQuota
}
if httpProxy := os.Getenv("http_proxy"); httpProxy != "" {
v.HttpProxy = httpProxy
}