summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/proc/fs.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2019-05-14 20:33:44 -0700
committerShentubot <shentubot@google.com>2019-05-14 20:34:50 -0700
commitdd153c014de69968dac96629e457ee17944e410e (patch)
tree66ee7503f31d89355a37e5942c3a5ee099dfa1a7 /pkg/sentry/fs/proc/fs.go
parent330a1bbd04815b846e9396e9f5763afe6350b537 (diff)
Start of support for /proc/pid/cgroup file.
PiperOrigin-RevId: 248263378 Change-Id: Ic057d2bb0b6212110f43ac4df3f0ac9bf931ab98
Diffstat (limited to 'pkg/sentry/fs/proc/fs.go')
-rw-r--r--pkg/sentry/fs/proc/fs.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/sentry/fs/proc/fs.go b/pkg/sentry/fs/proc/fs.go
index 7c5f8484a..d57d6cc5d 100644
--- a/pkg/sentry/fs/proc/fs.go
+++ b/pkg/sentry/fs/proc/fs.go
@@ -57,7 +57,7 @@ func (*filesystem) Flags() fs.FilesystemFlags {
}
// Mount returns the root of a procfs that can be positioned in the vfs.
-func (f *filesystem) Mount(ctx context.Context, device string, flags fs.MountSourceFlags, data string, _ interface{}) (*fs.Inode, error) {
+func (f *filesystem) Mount(ctx context.Context, device string, flags fs.MountSourceFlags, data string, cgroupsInt interface{}) (*fs.Inode, error) {
// device is always ignored.
// Parse generic comma-separated key=value options, this file system expects them.
@@ -70,7 +70,12 @@ func (f *filesystem) Mount(ctx context.Context, device string, flags fs.MountSou
return nil, fmt.Errorf("unsupported mount options: %v", options)
}
+ var cgroups map[string]string
+ if cgroupsInt != nil {
+ cgroups = cgroupsInt.(map[string]string)
+ }
+
// Construct the procfs root. Since procfs files are all virtual, we
// never want them cached.
- return New(ctx, fs.NewNonCachingMountSource(f, flags))
+ return New(ctx, fs.NewNonCachingMountSource(f, flags), cgroups)
}