Jelajahi Sumber

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 tahun lalu
induk
melakukan
e413340723
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      utils.go

+ 1 - 1
utils.go

@@ -442,7 +442,7 @@ func FindCgroupMountpoint(cgroupType string) (string, error) {
 		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") {
 		r := reg.FindStringSubmatch(line)
 		if len(r) == 2 {