lxccontainer: use cgroup_set()

parent efb4b3e8
...@@ -3277,6 +3277,7 @@ WRAP_API_1(bool, lxcapi_set_config_path, const char *) ...@@ -3277,6 +3277,7 @@ WRAP_API_1(bool, lxcapi_set_config_path, const char *)
static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsys, const char *value) static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsys, const char *value)
{ {
call_cleaner(cgroup_exit) struct cgroup_ops *cgroup_ops = NULL; call_cleaner(cgroup_exit) struct cgroup_ops *cgroup_ops = NULL;
int ret;
if (!c) if (!c)
return false; return false;
...@@ -3284,12 +3285,16 @@ static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsy ...@@ -3284,12 +3285,16 @@ static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsy
if (is_stopped(c)) if (is_stopped(c))
return false; return false;
cgroup_ops = cgroup_init(c->lxc_conf); ret = cgroup_set(c->lxc_conf, c->name, c->config_path, subsys, value);
if (!cgroup_ops) if (ret == ENOCGROUP2) {
return false; cgroup_ops = cgroup_init(c->lxc_conf);
if (!cgroup_ops)
return false;
ret = cgroup_ops->set(cgroup_ops, subsys, value, c->name, c->config_path) == 0;
}
return cgroup_ops->set(cgroup_ops, subsys, value, c->name, return ret == 0;
c->config_path) == 0;
} }
WRAP_API_2(bool, lxcapi_set_cgroup_item, const char *, const char *) WRAP_API_2(bool, lxcapi_set_cgroup_item, const char *, const char *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment