diff options
author | Ian Gudger <igudger@google.com> | 2018-10-15 17:47:24 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-15 17:48:11 -0700 |
commit | 167f2401c4abb1ebda1f4536a04d9854e9008e0b (patch) | |
tree | dc9c7d33f0635039bf3ba45e912fb693f3a99812 /pkg/sentry/uniqueid/context.go | |
parent | ecd94ea7a693d49a0edce8607241a8e2ac22bfe0 (diff) |
Merge host.endpoint into host.ConnectedEndpoint
host.endpoint contained duplicated logic from the sockerpair implementation and
host.ConnectedEndpoint. Remove host.endpoint in favor of a
host.ConnectedEndpoint wrapped in a socketpair end.
PiperOrigin-RevId: 217240096
Change-Id: I4a3d51e3fe82bdf30e2d0152458b8499ab4c987c
Diffstat (limited to 'pkg/sentry/uniqueid/context.go')
-rw-r--r-- | pkg/sentry/uniqueid/context.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/sentry/uniqueid/context.go b/pkg/sentry/uniqueid/context.go index eeb8c4286..541e0611d 100644 --- a/pkg/sentry/uniqueid/context.go +++ b/pkg/sentry/uniqueid/context.go @@ -18,6 +18,7 @@ package uniqueid import ( "gvisor.googlesource.com/gvisor/pkg/sentry/context" + "gvisor.googlesource.com/gvisor/pkg/tcpip/transport/unix" ) // contextID is the kernel package's type for context.Context.Value keys. @@ -28,6 +29,10 @@ const ( // unique identifier. CtxGlobalUniqueID contextID = iota + // CtxGlobalUniqueIDProvider is a Context.Value key for a + // system-wide unique identifier generator. + CtxGlobalUniqueIDProvider + // CtxInotifyCookie is a Context.Value key for a unique inotify // event cookie. CtxInotifyCookie @@ -38,6 +43,11 @@ func GlobalFromContext(ctx context.Context) uint64 { return ctx.Value(CtxGlobalUniqueID).(uint64) } +// GlobalProviderFromContext returns a system-wide unique identifier from ctx. +func GlobalProviderFromContext(ctx context.Context) unix.UniqueIDProvider { + return ctx.Value(CtxGlobalUniqueIDProvider).(unix.UniqueIDProvider) +} + // InotifyCookie generates a unique inotify event cookie from ctx. func InotifyCookie(ctx context.Context) uint32 { return ctx.Value(CtxInotifyCookie).(uint32) |