Value implements context.Context.Value.
(key any)
| 1175 | |
| 1176 | // Value implements context.Context.Value. |
| 1177 | func (ctx *createProcessContext) Value(key any) any { |
| 1178 | switch key { |
| 1179 | case CtxKernel: |
| 1180 | return ctx.kernel |
| 1181 | case CtxPIDNamespace: |
| 1182 | return ctx.args.PIDNamespace |
| 1183 | case CtxUTSNamespace: |
| 1184 | utsns := ctx.args.UTSNamespace |
| 1185 | utsns.IncRef() |
| 1186 | return utsns |
| 1187 | case ipc.CtxIPCNamespace: |
| 1188 | ipcns := ctx.args.IPCNamespace |
| 1189 | ipcns.IncRef() |
| 1190 | return ipcns |
| 1191 | case auth.CtxCredentials: |
| 1192 | return ctx.args.Credentials |
| 1193 | case vfs.CtxRoot: |
| 1194 | if ctx.args.MountNamespace == nil { |
| 1195 | return nil |
| 1196 | } |
| 1197 | root := ctx.args.MountNamespace.Root(ctx) |
| 1198 | return root |
| 1199 | case vfs.CtxMountNamespace: |
| 1200 | if ctx.kernel.globalInit == nil { |
| 1201 | return nil |
| 1202 | } |
| 1203 | mntns := ctx.kernel.GlobalInit().Leader().MountNamespace() |
| 1204 | mntns.IncRef() |
| 1205 | return mntns |
| 1206 | case devutil.CtxDevGoferClient: |
| 1207 | return ctx.kernel.GetDevGoferClient(ctx.kernel.ContainerName(ctx.args.ContainerID)) |
| 1208 | case inet.CtxStack: |
| 1209 | return ctx.kernel.RootNetworkNamespace().Stack() |
| 1210 | case ktime.CtxRealtimeClock: |
| 1211 | return ctx.kernel.RealtimeClock() |
| 1212 | case limits.CtxLimits: |
| 1213 | return ctx.args.Limits |
| 1214 | case pgalloc.CtxMemoryCgroupID: |
| 1215 | return ctx.getMemoryCgroupID() |
| 1216 | case pgalloc.CtxMemoryFile: |
| 1217 | return ctx.kernel.mf |
| 1218 | case platform.CtxPlatform: |
| 1219 | return ctx.kernel |
| 1220 | case uniqueid.CtxGlobalUniqueID: |
| 1221 | return ctx.kernel.UniqueID() |
| 1222 | case uniqueid.CtxGlobalUniqueIDProvider: |
| 1223 | return ctx.kernel |
| 1224 | case uniqueid.CtxInotifyCookie: |
| 1225 | return ctx.kernel.GenerateInotifyCookie() |
| 1226 | case unimpl.CtxEvents: |
| 1227 | return ctx.kernel |
| 1228 | default: |
| 1229 | return nil |
| 1230 | } |
| 1231 | } |
| 1232 | |
| 1233 | func (ctx *createProcessContext) getMemoryCgroupID() uint32 { |
| 1234 | for cg := range ctx.args.InitialCgroups { |
nothing calls this directly
no test coverage detected