From: David Ward Date: Thu, 3 May 2012 22:50:15 +0000 (+0200) Subject: lxc-cgroup: use correct terminology X-Git-Tag: lxc-0.8.0~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f10e7166ab7f6d2a6665842b2613dd45d1795cc9;p=thirdparty%2Flxc.git lxc-cgroup: use correct terminology lxc-cgroup gets or sets the value of a state object (such as 'cpuset.cpus'), not the value of a subsystem (which would be just 'cpuset'). Signed-off-by: David Ward Signed-off-by: Daniel Lezcano --- diff --git a/doc/lxc-cgroup.sgml.in b/doc/lxc-cgroup.sgml.in index 5acd313d4..806214877 100644 --- a/doc/lxc-cgroup.sgml.in +++ b/doc/lxc-cgroup.sgml.in @@ -48,8 +48,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - lxc-start -n name - subsystem value + lxc-cgroup -n name + state-object value @@ -58,17 +58,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Description - lxc-cgroup get or set value from the control - group associated with the - container name. If - no value is specified, the value of - the subsystem is displayed, otherwise - it is set. The lxc-cgroup does not assume the - correctness of the subsystem name, it - is up to the user to specify the - right subsystem name. + lxc-cgroup gets or sets the value of a + state-object (e.g., 'cpuset.cpus') + in the container's cgroup for the corresponding subsystem (e.g., + 'cpuset'). If no value is specified, the + current value of the state-object is + displayed; otherwise it is set. + + Note that lxc-cgroup does not check that the + state-object is valid for the running + kernel, or that the corresponding subsystem is contained in any + mounted cgroup hierarchy. + @@ -77,11 +80,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + - Specify the subsystem control group name. + Specify the state object name. @@ -92,7 +95,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Specify the subsystem control group value to be set. + Specify the value to assign to the state object. diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index e5145f905..f50c74aec 100644 --- a/src/lxc/cgroup.c +++ b/src/lxc/cgroup.c @@ -531,8 +531,8 @@ int lxc_cgroup_path_get(char **path, const char *subsystem, const char *name) static char buf[MAXPATHLEN]; static char retbuf[MAXPATHLEN]; - /* what lxc_cgroup_set calls subsystem is actually the filename, i.e. - 'devices.allow'. So for our purposee we trim it */ + /* lxc_cgroup_set passes a state object for the subsystem, + * so trim it to just the subsystem part */ if (subsystem) { snprintf(retbuf, MAXPATHLEN, "%s", subsystem); char *s = index(retbuf, '.'); diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index d5aa5aa9a..97769a5a2 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -36,7 +36,7 @@ lxc_log_define(lxc_cgroup_ui, lxc_cgroup); static int my_checker(const struct lxc_arguments* args) { if (!args->argc) { - lxc_error(args, "missing cgroup subsystem"); + lxc_error(args, "missing state object"); return -1; } return 0; @@ -49,13 +49,13 @@ static const struct option my_longopts[] = { static struct lxc_arguments my_args = { .progname = "lxc-cgroup", .help = "\ ---name=NAME subsystem [value]\n\ +--name=NAME state-object [value]\n\ \n\ -lxc-cgroup get or set subsystem value of cgroup\n\ -associated with the NAME container\n\ +Get or set the value of a state object (for example, 'cpuset.cpus')\n\ +in the container's cgroup for the corresponding subsystem.\n\ \n\ Options :\n\ - -n, --name=NAME NAME for name of the container", + -n, --name=NAME container name", .options = my_longopts, .parser = NULL, .checker = my_checker, @@ -63,7 +63,7 @@ Options :\n\ int main(int argc, char *argv[]) { - char *subsystem = NULL, *value = NULL; + char *state_object = NULL, *value = NULL; if (lxc_arguments_parse(&my_args, argc, argv)) return -1; @@ -72,15 +72,15 @@ int main(int argc, char *argv[]) my_args.progname, my_args.quiet)) return -1; - subsystem = my_args.argv[0]; + state_object = my_args.argv[0]; if ((argc) > 1) value = my_args.argv[1]; if (value) { - if (lxc_cgroup_set(my_args.name, subsystem, value)) { + if (lxc_cgroup_set(my_args.name, state_object, value)) { ERROR("failed to assign '%s' value to '%s' for '%s'", - value, subsystem, my_args.name); + value, state_object, my_args.name); return -1; } } else { @@ -88,10 +88,10 @@ int main(int argc, char *argv[]) int ret; char buffer[len]; - ret = lxc_cgroup_get(my_args.name, subsystem, buffer, len); + ret = lxc_cgroup_get(my_args.name, state_object, buffer, len); if (ret < 0) { ERROR("failed to retrieve value of '%s' for '%s'", - subsystem, my_args.name); + state_object, my_args.name); return -1; }