From 4348ad68f818ed72752bcf66d30f53cf15598bb4 Mon Sep 17 00:00:00 2001 From: John Howard Date: Thu, 9 Jul 2015 16:37:54 -0700 Subject: [PATCH] Windows: Fix docker info not to SIGSEGV Signed-off-by: John Howard --- daemon/info.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/daemon/info.go b/daemon/info.go index f8994953ab..4c73377b64 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -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 }