Skip to content

Commit 4893ecc

Browse files
author
Jessie Frazelle
committed
Merge pull request moby#14512 from Microsoft/10662-fixdockerinfo
Windows: Fix docker info not to SIGSEGV
2 parents 56e8a99 + 4348ad6 commit 4893ecc

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

daemon/info.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,11 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
6262
Images: imgcount,
6363
Driver: daemon.GraphDriver().String(),
6464
DriverStatus: daemon.GraphDriver().Status(),
65-
MemoryLimit: daemon.SystemConfig().MemoryLimit,
66-
SwapLimit: daemon.SystemConfig().SwapLimit,
67-
CpuCfsPeriod: daemon.SystemConfig().CpuCfsPeriod,
68-
CpuCfsQuota: daemon.SystemConfig().CpuCfsQuota,
6965
IPv4Forwarding: !daemon.SystemConfig().IPv4ForwardingDisabled,
7066
BridgeNfIptables: !daemon.SystemConfig().BridgeNfCallIptablesDisabled,
7167
BridgeNfIp6tables: !daemon.SystemConfig().BridgeNfCallIp6tablesDisabled,
7268
Debug: os.Getenv("DEBUG") != "",
7369
NFd: fileutils.GetTotalUsedFds(),
74-
OomKillDisable: daemon.SystemConfig().OomKillDisable,
7570
NGoroutines: runtime.NumGoroutine(),
7671
SystemTime: time.Now().Format(time.RFC3339Nano),
7772
ExecutionDriver: daemon.ExecutionDriver().Name(),
@@ -90,6 +85,18 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
9085
ExperimentalBuild: utils.ExperimentalBuild(),
9186
}
9287

88+
// TODO Windows. Refactor this more once sysinfo is refactored into
89+
// platform specific code. On Windows, sysinfo.cgroupMemInfo and
90+
// sysinfo.cgroupCpuInfo will be nil otherwise and cause a SIGSEGV if
91+
// an attempt is made to access through them.
92+
if runtime.GOOS != "windows" {
93+
v.MemoryLimit = daemon.SystemConfig().MemoryLimit
94+
v.SwapLimit = daemon.SystemConfig().SwapLimit
95+
v.OomKillDisable = daemon.SystemConfig().OomKillDisable
96+
v.CpuCfsPeriod = daemon.SystemConfig().CpuCfsPeriod
97+
v.CpuCfsQuota = daemon.SystemConfig().CpuCfsQuota
98+
}
99+
93100
if httpProxy := os.Getenv("http_proxy"); httpProxy != "" {
94101
v.HttpProxy = httpProxy
95102
}

0 commit comments

Comments
 (0)