Update memory specs to use int64 not uint64

replace #1492 #1494
fix #1422

Since https://github.com/opencontainers/runtime-spec/pull/876 the memory
specifications are now `int64`, as that better matches the visible interface where
`-1` is a valid value. Otherwise finding the correct value was difficult as it
was kernel dependent.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack
2017-06-23 17:17:00 -07:00
parent e1146182a8
commit 3d9074ead3
3 changed files with 29 additions and 31 deletions
+7 -7
View File
@@ -124,11 +124,11 @@ other options are ignored.
r := specs.LinuxResources{
Memory: &specs.LinuxMemory{
Limit: u64Ptr(0),
Reservation: u64Ptr(0),
Swap: u64Ptr(0),
Kernel: u64Ptr(0),
KernelTCP: u64Ptr(0),
Limit: i64Ptr(0),
Reservation: i64Ptr(0),
Swap: i64Ptr(0),
Kernel: i64Ptr(0),
KernelTCP: i64Ptr(0),
},
CPU: &specs.LinuxCPU{
Shares: u64Ptr(0),
@@ -213,7 +213,7 @@ other options are ignored.
}
for _, pair := range []struct {
opt string
dest *uint64
dest *int64
}{
{"memory", r.Memory.Limit},
{"memory-swap", r.Memory.Swap},
@@ -232,7 +232,7 @@ other options are ignored.
} else {
v = -1
}
*pair.dest = uint64(v)
*pair.dest = v
}
}
r.Pids.Limit = int64(context.Int("pids-limit"))