浏览代码

Update FindCgroupMountpoint to be more forgiving

On Gentoo, the memory cgroup is mounted at /sys/fs/cgroup/memory, but the mount line looks like the following:
memory on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)

(note that the first word on the line is "memory", not "cgroup", but the other essentials are there, namely the type of cgroup and the memory mount option)
Tianon Gravi 12 年之前
父节点
当前提交
e413340723
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      utils.go

+ 1 - 1
utils.go

@@ -442,7 +442,7 @@ func FindCgroupMountpoint(cgroupType string) (string, error) {
 		return "", err
 		return "", err
 	}
 	}
 
 
-	reg := regexp.MustCompile(`^cgroup on (.*) type cgroup \(.*` + cgroupType + `[,\)]`)
+	reg := regexp.MustCompile(`^.* on (.*) type cgroup \(.*` + cgroupType + `[,\)]`)
 	for _, line := range strings.Split(string(output), "\n") {
 	for _, line := range strings.Split(string(output), "\n") {
 		r := reg.FindStringSubmatch(line)
 		r := reg.FindStringSubmatch(line)
 		if len(r) == 2 {
 		if len(r) == 2 {