]> err.no Git - systemd/commitdiff
cgroup: mount cgroup file systems to /sys/fs/cgroup instead of /cgroup
authorLennart Poettering <lennart@poettering.net>
Wed, 25 Aug 2010 02:58:16 +0000 (04:58 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 25 Aug 2010 02:58:24 +0000 (04:58 +0200)
This requires the /sys/fs/cgroup to exist. Current git kernels have
this, released kernels need a backport of a single patch.

Makefile.am
man/sd_booted.xml
man/systemd-cgls.xml
man/systemd.xml
src/cgls.c
src/cgroup-util.c
src/mount-setup.c
src/sd-daemon.c
src/test-cgroup.c

index 859d3326793cea7110f1fc9bfc85c747401aa362..725685dfb0b2ebf944e67417cb148c75145ec966 100644 (file)
@@ -847,8 +847,6 @@ install-data-hook:
                $(DESTDIR)$(pkgsysconfdir)/system/graphical.target.wants \
                $(DESTDIR)$(pkgsysconfdir)/session \
                $(DESTDIR)$(sysconfdir)/xdg/systemd
-       $(MKDIR_P) -m 0755 $(DESTDIR)/cgroup || \
-               echo "Don't forget to create /cgroup! Couldn't create it for you, continuing anyway."
        ( cd $(DESTDIR)$(sysconfdir)/xdg/systemd/ && \
                rm -f session && \
                $(LN_S) $(pkgsysconfdir)/session session )
index 15cd6ce4f74eb3c8a20d630c933a1952bfe415f2..841ee1d47904bcc91a108c2a8750c051095842f9 100644 (file)
                 implementation.</para>
 
                 <para>Internally, this function checks whether the
-                <filename>/cgroup/systemd</filename> virtual file
+                <filename>/sys/fs/cgroup/systemd</filename> virtual file
                 system is mounted, by comparing the st_dev value of
                 the <function>stat()</function> data of
-                <filename>/cgroup</filename> and
-                <filename>/cgroup/systemd</filename>.</para>
+                <filename>/sys/fs/cgroup</filename> and
+                <filename>/sys/fs/cgroup/systemd</filename>.</para>
 
                 <para>For details about the algorithm check the
                 liberally licensed reference implementation sources:
index da3e0cac730e1e9de198ca020333454fa4b7fe31..8546e39433652c6446c7f353219ff8f163302246 100644 (file)
@@ -65,7 +65,7 @@
                 file paths or are assumed in the systemd control group
                 hierarchy. If no argument is specified and the current
                 working directory is beneath the control group mount
-                point <filename>/cgroup</filename> shows the contents
+                point <filename>/sys/fs/cgroup</filename> shows the contents
                 of the control group the working directory refers
                 to. Otherwise the full systemd control group hierarchy
                 is shown.</para>
index 6edce4996a99ba76cb5f6bc03c70436954518d41..edd824d31d4ff41fd95ac31290d81576f7004f5c 100644 (file)
                 track of processes. Control group information is
                 maintained in the kernel, and is accessible via the
                 file system hierarchy (beneath
-                <filename>/cgroup/systemd/</filename>), or in tools
+                <filename>/sys/fs/cgroup/systemd/</filename>), or in tools
                 such as
                 <citerefentry><refentrytitle>ps</refentrytitle><manvolnum>1</manvolnum></citerefentry>
                 (<command>ps xawf -eo pid,user,cgroup,args</command>
index 2940e3724bbcd584d5055bf8f067f9c7115c4444..f1f3046edfd1897d2709c43c734ed3a5349f8e54 100644 (file)
@@ -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
index 07e4e64fefc7ca8dced183fdb17235bb527bbe51..6abb6b549a04706336a3baa1613bce4b840c9714 100644 (file)
@@ -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)))
index 8b4d8c7f4420c0a5de37423ba3e82129b0729845..c1ddbe45f0c116df924e20932b68118b92b15829 100644 (file)
@@ -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;
index 33970f6c41bb1bccc2b10b58d95db4966fbc7cda..9b4e010327f7c72f0d41449d2d28bce2c4ea72f1 100644 (file)
@@ -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;
index bebca7b50fe9c077588ebacc0bc5a5aaff9afe8a..63329a397c10a9735ab01327974ab6e24df7da03 100644 (file)
@@ -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);