mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
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:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user