summaryrefslogtreecommitdiffhomepage
path: root/runsc/cgroup
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-10-11 21:34:05 +0000
committergVisor bot <gvisor-bot@google.com>2021-10-11 21:34:05 +0000
commit547abe40676ef7c6f7f7ecfc6e203dd3e00e8d8e (patch)
tree2987ca70d6744351f9544a4dab5b137c60d87589 /runsc/cgroup
parent9eafd724b83cc00583226619606921fcef05f447 (diff)
parentb9176535cea01e35f819edf312d0f5e7da3e8ffd (diff)
Merge release-20210927.0-58-gb9176535c (automated)
Diffstat (limited to 'runsc/cgroup')
-rw-r--r--runsc/cgroup/cgroup.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/runsc/cgroup/cgroup.go b/runsc/cgroup/cgroup.go
index 5dbf14376..7280a52fc 100644
--- a/runsc/cgroup/cgroup.go
+++ b/runsc/cgroup/cgroup.go
@@ -309,7 +309,13 @@ func NewFromSpec(spec *specs.Spec) (*Cgroup, error) {
if spec.Linux == nil || spec.Linux.CgroupsPath == "" {
return nil, nil
}
- return new("self", spec.Linux.CgroupsPath)
+ return NewFromPath(spec.Linux.CgroupsPath)
+}
+
+// NewFromPath creates a new Cgroup instance from the specified relative path.
+// Cgroup paths are loaded based on the current process.
+func NewFromPath(cgroupsPath string) (*Cgroup, error) {
+ return new("self", cgroupsPath)
}
// NewFromPid loads cgroup for the given process.