summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-08-25 04:58:16 +0200
committerLennart Poettering <lennart@poettering.net>2010-08-25 04:58:24 +0200
commit77d5f105bf63330350c7bddacdeda914f945590f (patch)
tree3db8a21164833c8c0c48ffe6ee7820858d3d19b9 /src
parentee2083d5cacd8b6065b6a38d284f3e28961775a4 (diff)
cgroup: mount cgroup file systems to /sys/fs/cgroup instead of /cgroup
This requires the /sys/fs/cgroup to exist. Current git kernels have this, released kernels need a backport of a single patch.
Diffstat (limited to 'src')
-rw-r--r--src/cgls.c2
-rw-r--r--src/cgroup-util.c4
-rw-r--r--src/mount-setup.c18
-rw-r--r--src/sd-daemon.c4
-rw-r--r--src/test-cgroup.c2
5 files changed, 15 insertions, 15 deletions
diff --git a/src/cgls.c b/src/cgls.c
index 2940e3724b..f1f3046edf 100644
--- a/src/cgls.c
+++ b/src/cgls.c
@@ -103,7 +103,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (path_startswith(p, "/cgroup")) {
+ if (path_startswith(p, "/sys/fs/cgroup")) {
printf("Working Directory %s:\n", p);
r = show_cgroup_by_path(p, NULL, 0);
} else
diff --git a/src/cgroup-util.c b/src/cgroup-util.c
index 07e4e64fef..6abb6b549a 100644
--- a/src/cgroup-util.c
+++ b/src/cgroup-util.c
@@ -481,7 +481,7 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch
else
p = controller;
- if (asprintf(&mp, "/cgroup/%s", p) < 0)
+ if (asprintf(&mp, "/sys/fs/cgroup/%s", p) < 0)
return -ENOMEM;
if ((r = path_is_mount_point(mp)) <= 0) {
@@ -927,7 +927,7 @@ int cg_fix_path(const char *path, char **result) {
/* First check if it already is a filesystem path */
if (path_is_absolute(path) &&
- path_startswith(path, "/cgroup") &&
+ path_startswith(path, "/sys/fs/cgroup") &&
access(path, F_OK) >= 0) {
if (!(t = strdup(path)))
diff --git a/src/mount-setup.c b/src/mount-setup.c
index 8b4d8c7f44..c1ddbe45f0 100644
--- a/src/mount-setup.c
+++ b/src/mount-setup.c
@@ -42,13 +42,13 @@ typedef struct MountPoint {
} MountPoint;
static const MountPoint mount_table[] = {
- { "proc", "/proc", "proc", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
- { "sysfs", "/sys", "sysfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
- { "devtmpfs", "/dev", "devtmpfs", "mode=755", MS_NOSUID, true },
- { "tmpfs", "/dev/shm", "tmpfs", "mode=1777", MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
- { "devpts", "/dev/pts", "devpts", NULL, MS_NOSUID|MS_NOEXEC, false },
- { "tmpfs", "/cgroup", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
- { "cgroup", "/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
+ { "proc", "/proc", "proc", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
+ { "sysfs", "/sys", "sysfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
+ { "devtmpfs", "/dev", "devtmpfs", "mode=755", MS_NOSUID, true },
+ { "tmpfs", "/dev/shm", "tmpfs", "mode=1777", MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
+ { "devpts", "/dev/pts", "devpts", NULL, MS_NOSUID|MS_NOEXEC, false },
+ { "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
+ { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV, true },
};
/* These are API file systems that might be mounted by other software,
@@ -75,7 +75,7 @@ bool mount_point_is_api(const char *path) {
if (path_equal(path, ignore_paths[i]))
return true;
- return path_startswith(path, "/cgroup/");
+ return path_startswith(path, "/sys/fs/cgroup/");
}
static int mount_one(const MountPoint *p) {
@@ -138,7 +138,7 @@ static int mount_cgroup_controllers(void) {
goto finish;
}
- if (asprintf(&where, "/cgroup/%s", controller) < 0) {
+ if (asprintf(&where, "/sys/fs/cgroup/%s", controller) < 0) {
free(controller);
r = -ENOMEM;
goto finish;
diff --git a/src/sd-daemon.c b/src/sd-daemon.c
index 33970f6c41..9b4e010327 100644
--- a/src/sd-daemon.c
+++ b/src/sd-daemon.c
@@ -441,10 +441,10 @@ int sd_booted(void) {
/* We simply test whether the systemd cgroup hierarchy is
* mounted */
- if (lstat("/cgroup", &a) < 0)
+ if (lstat("/sys/fs/cgroup", &a) < 0)
return 0;
- if (lstat("/cgroup/systemd", &b) < 0)
+ if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
return 0;
return a.st_dev != b.st_dev;
diff --git a/src/test-cgroup.c b/src/test-cgroup.c
index bebca7b50f..63329a397c 100644
--- a/src/test-cgroup.c
+++ b/src/test-cgroup.c
@@ -53,7 +53,7 @@ int main(int argc, char*argv[]) {
free(path);
assert_se(cg_get_path(SYSTEMD_CGROUP_CONTROLLER, "/test-b/test-d", NULL, &path) == 0);
- assert_se(path_equal(path, "/cgroup/systemd/test-b/test-d"));
+ assert_se(path_equal(path, "/sys/fs/cgroup/systemd/test-b/test-d"));
free(path);
assert_se(cg_is_empty(SYSTEMD_CGROUP_CONTROLLER, "/test-a", false) > 0);