Browse code

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 authored on 2013/04/23 16:09:29
Showing 1 changed files
... ...
@@ -442,7 +442,7 @@ func FindCgroupMountpoint(cgroupType string) (string, error) {
442 442
 		return "", err
443 443
 	}
444 444
 
445
-	reg := regexp.MustCompile(`^cgroup on (.*) type cgroup \(.*` + cgroupType + `[,\)]`)
445
+	reg := regexp.MustCompile(`^.* on (.*) type cgroup \(.*` + cgroupType + `[,\)]`)
446 446
 	for _, line := range strings.Split(string(output), "\n") {
447 447
 		r := reg.FindStringSubmatch(line)
448 448
 		if len(r) == 2 {