summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/context.go
diff options
context:
space:
mode:
authorZyad A. Ali <zyad.ali.me@gmail.com>2021-08-11 21:24:10 +0200
committerZyad A. Ali <zyad.ali.me@gmail.com>2021-09-17 11:16:25 +0200
commitbcef079ec24d56d37a670c4c4149c638be6fb110 (patch)
treeafcc54ea1f5ce50dbf7e2b94f8b59738f6df7125 /pkg/sentry/kernel/context.go
parente452ecd49526f4a0bbacc462840fbc6e88781e36 (diff)
Move CtxIPCNamespace to kernel/ipc package.
CtxIPCNamespace is needed by mqfs package to be able to retreive an IPCNamespace using ctx.Value. As ctx.Value compares keys as interfaces, we need to use type kernel.contextID in package mqfs, which is not possible due to circular depenedency, so move it to kernel/ipc instead. Updates #136
Diffstat (limited to 'pkg/sentry/kernel/context.go')
-rw-r--r--pkg/sentry/kernel/context.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/pkg/sentry/kernel/context.go b/pkg/sentry/kernel/context.go
index a8596410f..7e11c6580 100644
--- a/pkg/sentry/kernel/context.go
+++ b/pkg/sentry/kernel/context.go
@@ -16,6 +16,7 @@ package kernel
import (
"gvisor.dev/gvisor/pkg/context"
+ "gvisor.dev/gvisor/pkg/sentry/kernel/ipc"
)
// contextID is the kernel package's type for context.Context.Value keys.
@@ -37,9 +38,6 @@ const (
// CtxUTSNamespace is a Context.Value key for a UTSNamespace.
CtxUTSNamespace
-
- // CtxIPCNamespace is a Context.Value key for a IPCNamespace.
- CtxIPCNamespace
)
// ContextCanTrace returns true if ctx is permitted to trace t, in the same sense
@@ -82,7 +80,7 @@ func UTSNamespaceFromContext(ctx context.Context) *UTSNamespace {
// or nil if there is no such IPC namespace. It takes a reference on the
// namespace.
func IPCNamespaceFromContext(ctx context.Context) *IPCNamespace {
- if v := ctx.Value(CtxIPCNamespace); v != nil {
+ if v := ctx.Value(ipc.CtxIPCNamespace); v != nil {
return v.(*IPCNamespace)
}
return nil