|
26 | 26 | } |
27 | 27 | ) |
28 | 28 |
|
| 29 | +const ( |
| 30 | + // UnlimitedPidsLimit can be passed to SetLinuxResourcesPidsLimit to |
| 31 | + // request unlimited PIDs. |
| 32 | + UnlimitedPidsLimit int64 = -1 |
| 33 | +) |
| 34 | + |
29 | 35 | // Generator represents a generator for a container config. |
30 | 36 | type Generator struct { |
31 | 37 | Config *rspec.Spec |
@@ -911,7 +917,7 @@ func (g *Generator) SetLinuxResourcesMemorySwap(swap int64) { |
911 | 917 | // SetLinuxResourcesMemoryKernel sets g.Config.Linux.Resources.Memory.Kernel. |
912 | 918 | func (g *Generator) SetLinuxResourcesMemoryKernel(kernel int64) { |
913 | 919 | g.initConfigLinuxResourcesMemory() |
914 | | - g.Config.Linux.Resources.Memory.Kernel = &kernel |
| 920 | + g.Config.Linux.Resources.Memory.Kernel = &kernel //nolint:staticcheck // Ignore SA1019: g.Config.Linux.Resources.Memory.Kernel is deprecated |
915 | 921 | } |
916 | 922 |
|
917 | 923 | // SetLinuxResourcesMemoryKernelTCP sets g.Config.Linux.Resources.Memory.KernelTCP. |
@@ -970,7 +976,7 @@ func (g *Generator) DropLinuxResourcesNetworkPriorities(name string) { |
970 | 976 | // SetLinuxResourcesPidsLimit sets g.Config.Linux.Resources.Pids.Limit. |
971 | 977 | func (g *Generator) SetLinuxResourcesPidsLimit(limit int64) { |
972 | 978 | g.initConfigLinuxResourcesPids() |
973 | | - g.Config.Linux.Resources.Pids.Limit = limit |
| 979 | + g.Config.Linux.Resources.Pids.Limit = &limit |
974 | 980 | } |
975 | 981 |
|
976 | 982 | // ClearLinuxSysctl clears g.Config.Linux.Sysctl. |
@@ -1060,13 +1066,13 @@ func (g *Generator) ClearPreStartHooks() { |
1060 | 1066 | if g.Config == nil || g.Config.Hooks == nil { |
1061 | 1067 | return |
1062 | 1068 | } |
1063 | | - g.Config.Hooks.Prestart = []rspec.Hook{} |
| 1069 | + g.Config.Hooks.Prestart = []rspec.Hook{} //nolint:staticcheck // Ignore SA1019: g.Config.Hooks.Prestart is deprecated |
1064 | 1070 | } |
1065 | 1071 |
|
1066 | 1072 | // AddPreStartHook add a prestart hook into g.Config.Hooks.Prestart. |
1067 | 1073 | func (g *Generator) AddPreStartHook(preStartHook rspec.Hook) { |
1068 | 1074 | g.initConfigHooks() |
1069 | | - g.Config.Hooks.Prestart = append(g.Config.Hooks.Prestart, preStartHook) |
| 1075 | + g.Config.Hooks.Prestart = append(g.Config.Hooks.Prestart, preStartHook) //nolint:staticcheck // Ignore SA1019: g.Config.Hooks.Prestart is deprecated |
1070 | 1076 | } |
1071 | 1077 |
|
1072 | 1078 | // ClearPostStopHooks clear g.Config.Hooks.Poststop. |
|
0 commit comments