1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #14512 from Microsoft/10662-fixdockerinfo

Windows: Fix docker info not to SIGSEGV
This commit is contained in:
Jessie Frazelle 2015-07-09 17:16:49 -07:00
commit 4893ecc112

View file

@ -62,16 +62,11 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
Images: imgcount, Images: imgcount,
Driver: daemon.GraphDriver().String(), Driver: daemon.GraphDriver().String(),
DriverStatus: daemon.GraphDriver().Status(), DriverStatus: daemon.GraphDriver().Status(),
MemoryLimit: daemon.SystemConfig().MemoryLimit,
SwapLimit: daemon.SystemConfig().SwapLimit,
CpuCfsPeriod: daemon.SystemConfig().CpuCfsPeriod,
CpuCfsQuota: daemon.SystemConfig().CpuCfsQuota,
IPv4Forwarding: !daemon.SystemConfig().IPv4ForwardingDisabled, IPv4Forwarding: !daemon.SystemConfig().IPv4ForwardingDisabled,
BridgeNfIptables: !daemon.SystemConfig().BridgeNfCallIptablesDisabled, BridgeNfIptables: !daemon.SystemConfig().BridgeNfCallIptablesDisabled,
BridgeNfIp6tables: !daemon.SystemConfig().BridgeNfCallIp6tablesDisabled, BridgeNfIp6tables: !daemon.SystemConfig().BridgeNfCallIp6tablesDisabled,
Debug: os.Getenv("DEBUG") != "", Debug: os.Getenv("DEBUG") != "",
NFd: fileutils.GetTotalUsedFds(), NFd: fileutils.GetTotalUsedFds(),
OomKillDisable: daemon.SystemConfig().OomKillDisable,
NGoroutines: runtime.NumGoroutine(), NGoroutines: runtime.NumGoroutine(),
SystemTime: time.Now().Format(time.RFC3339Nano), SystemTime: time.Now().Format(time.RFC3339Nano),
ExecutionDriver: daemon.ExecutionDriver().Name(), ExecutionDriver: daemon.ExecutionDriver().Name(),
@ -90,6 +85,18 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
ExperimentalBuild: utils.ExperimentalBuild(), 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 != "" { if httpProxy := os.Getenv("http_proxy"); httpProxy != "" {
v.HttpProxy = httpProxy v.HttpProxy = httpProxy
} }