From: Christian Brauner Date: Sun, 23 Sep 2018 22:14:22 +0000 (+0200) Subject: cgroups: introduce helper macros X-Git-Tag: lxc-3.1.0~81^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=625ad37b595868abb9c82fcf8665f2b4af522b5c;p=thirdparty%2Flxc.git cgroups: introduce helper macros Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index a2d2f1927..22a559e12 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -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; } diff --git a/src/lxc/cgroups/cgroup.c b/src/lxc/cgroups/cgroup.c index cf81f3edb..f223958da 100644 --- a/src/lxc/cgroups/cgroup.c +++ b/src/lxc/cgroups/cgroup.c @@ -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; diff --git a/src/lxc/cgroups/cgroup.h b/src/lxc/cgroups/cgroup.h index e0a33563a..976883a3c 100644 --- a/src/lxc/cgroups/cgroup.h +++ b/src/lxc/cgroups/cgroup.h @@ -28,6 +28,10 @@ #include #include +#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