]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: introduce helper macros
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 23 Sep 2018 22:14:22 +0000 (00:14 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 26 Sep 2018 12:11:47 +0000 (14:11 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c
src/lxc/cgroups/cgroup.c
src/lxc/cgroups/cgroup.h

index a2d2f192725b830d6e83753a090346e431079b70..22a559e124fb4f8dc0df29326d806641d1a10feb 100644 (file)
@@ -1159,12 +1159,12 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
                        pivot_path = must_make_path(h->mountpoint,
                                                    h->container_base_path,
                                                    conf->cgroup_meta.dir,
-                                                   "lxc.pivot",
+                                                   PIVOT_CGROUP,
                                                    "cgroup.procs", NULL);
                else
                        pivot_path = must_make_path(h->mountpoint,
                                                    h->container_base_path,
-                                                   "lxc.pivot",
+                                                   PIVOT_CGROUP,
                                                    "cgroup.procs", NULL);
 
                ret = mkdir_p(pivot_path, 0755);
@@ -2714,7 +2714,7 @@ __cgfsng_ops static bool cgfsng_data_init(struct cgroup_ops *ops)
                return false;
        }
        ops->cgroup_pattern = must_copy_string(cgroup_pattern);
-       ops->monitor_pattern = must_copy_string("lxc.monitor");
+       ops->monitor_pattern = MONITOR_CGROUP;
 
        return true;
 }
index cf81f3edbf85cfb2082a29429cb601973f7560bd..f223958da19fa5dd2385191c46164283b3471599 100644 (file)
@@ -76,7 +76,6 @@ void cgroup_exit(struct cgroup_ops *ops)
 
        free(ops->cgroup_pattern);
        free(ops->container_cgroup);
-       free(ops->monitor_pattern);
 
        for (it = ops->hierarchies; it && *it; it++) {
                char **ctrlr;
index e0a33563ab8c4a0ee0377701db8d969857c363de..976883a3c2e4f05e75d38630c407f63fa6b44114 100644 (file)
 #include <stddef.h>
 #include <sys/types.h>
 
+#define PAYLOAD_CGROUP "lxc.payload"
+#define MONITOR_CGROUP "lxc.monitor"
+#define PIVOT_CGROUP "lxc.pivot"
+
 struct lxc_handler;
 struct lxc_conf;
 struct lxc_list;
@@ -96,6 +100,8 @@ struct cgroup_ops {
        char **cgroup_use;
        char *cgroup_pattern;
        char *container_cgroup;
+
+       /* Static memory, do not free.*/
        char *monitor_pattern;
 
        /* @hierarchies