summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/shm
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/kernel/shm')
-rw-r--r--pkg/sentry/kernel/shm/BUILD28
-rw-r--r--pkg/sentry/kernel/shm/shm_state_autogen.go118
2 files changed, 118 insertions, 28 deletions
diff --git a/pkg/sentry/kernel/shm/BUILD b/pkg/sentry/kernel/shm/BUILD
deleted file mode 100644
index c211fc8d0..000000000
--- a/pkg/sentry/kernel/shm/BUILD
+++ /dev/null
@@ -1,28 +0,0 @@
-load("//tools:defs.bzl", "go_library")
-
-package(licenses = ["notice"])
-
-go_library(
- name = "shm",
- srcs = [
- "device.go",
- "shm.go",
- ],
- visibility = ["//pkg/sentry:internal"],
- deps = [
- "//pkg/abi/linux",
- "//pkg/context",
- "//pkg/log",
- "//pkg/refs",
- "//pkg/sentry/device",
- "//pkg/sentry/fs",
- "//pkg/sentry/kernel/auth",
- "//pkg/sentry/kernel/time",
- "//pkg/sentry/memmap",
- "//pkg/sentry/pgalloc",
- "//pkg/sentry/usage",
- "//pkg/sync",
- "//pkg/syserror",
- "//pkg/usermem",
- ],
-)
diff --git a/pkg/sentry/kernel/shm/shm_state_autogen.go b/pkg/sentry/kernel/shm/shm_state_autogen.go
new file mode 100644
index 000000000..c98632087
--- /dev/null
+++ b/pkg/sentry/kernel/shm/shm_state_autogen.go
@@ -0,0 +1,118 @@
+// automatically generated by stateify.
+
+package shm
+
+import (
+ "gvisor.dev/gvisor/pkg/state"
+)
+
+func (x *Registry) StateTypeName() string {
+ return "pkg/sentry/kernel/shm.Registry"
+}
+
+func (x *Registry) StateFields() []string {
+ return []string{
+ "userNS",
+ "shms",
+ "keysToShms",
+ "totalPages",
+ "lastIDUsed",
+ }
+}
+
+func (x *Registry) beforeSave() {}
+
+func (x *Registry) StateSave(m state.Sink) {
+ x.beforeSave()
+ m.Save(0, &x.userNS)
+ m.Save(1, &x.shms)
+ m.Save(2, &x.keysToShms)
+ m.Save(3, &x.totalPages)
+ m.Save(4, &x.lastIDUsed)
+}
+
+func (x *Registry) afterLoad() {}
+
+func (x *Registry) StateLoad(m state.Source) {
+ m.Load(0, &x.userNS)
+ m.Load(1, &x.shms)
+ m.Load(2, &x.keysToShms)
+ m.Load(3, &x.totalPages)
+ m.Load(4, &x.lastIDUsed)
+}
+
+func (x *Shm) StateTypeName() string {
+ return "pkg/sentry/kernel/shm.Shm"
+}
+
+func (x *Shm) StateFields() []string {
+ return []string{
+ "AtomicRefCount",
+ "mfp",
+ "registry",
+ "ID",
+ "creator",
+ "size",
+ "effectiveSize",
+ "fr",
+ "key",
+ "perms",
+ "owner",
+ "attachTime",
+ "detachTime",
+ "changeTime",
+ "creatorPID",
+ "lastAttachDetachPID",
+ "pendingDestruction",
+ }
+}
+
+func (x *Shm) beforeSave() {}
+
+func (x *Shm) StateSave(m state.Sink) {
+ x.beforeSave()
+ m.Save(0, &x.AtomicRefCount)
+ m.Save(1, &x.mfp)
+ m.Save(2, &x.registry)
+ m.Save(3, &x.ID)
+ m.Save(4, &x.creator)
+ m.Save(5, &x.size)
+ m.Save(6, &x.effectiveSize)
+ m.Save(7, &x.fr)
+ m.Save(8, &x.key)
+ m.Save(9, &x.perms)
+ m.Save(10, &x.owner)
+ m.Save(11, &x.attachTime)
+ m.Save(12, &x.detachTime)
+ m.Save(13, &x.changeTime)
+ m.Save(14, &x.creatorPID)
+ m.Save(15, &x.lastAttachDetachPID)
+ m.Save(16, &x.pendingDestruction)
+}
+
+func (x *Shm) afterLoad() {}
+
+func (x *Shm) StateLoad(m state.Source) {
+ m.Load(0, &x.AtomicRefCount)
+ m.Load(1, &x.mfp)
+ m.Load(2, &x.registry)
+ m.Load(3, &x.ID)
+ m.Load(4, &x.creator)
+ m.Load(5, &x.size)
+ m.Load(6, &x.effectiveSize)
+ m.Load(7, &x.fr)
+ m.Load(8, &x.key)
+ m.Load(9, &x.perms)
+ m.Load(10, &x.owner)
+ m.Load(11, &x.attachTime)
+ m.Load(12, &x.detachTime)
+ m.Load(13, &x.changeTime)
+ m.Load(14, &x.creatorPID)
+ m.Load(15, &x.lastAttachDetachPID)
+ m.Load(16, &x.pendingDestruction)
+}
+
+func init() {
+ state.Register((*Registry)(nil))
+ state.Register((*Shm)(nil))
+}