<refsynopsisdiv>
<cmdsynopsis>
- <command>lxc-start <replaceable>-n name</replaceable>
- <replaceable>subsystem</replaceable> <optional>value</optional>
+ <command>lxc-cgroup -n <replaceable>name</replaceable>
+ <replaceable>state-object</replaceable> <optional>value</optional>
</command>
</cmdsynopsis>
</refsynopsisdiv>
<title>Description</title>
<para>
- <command>lxc-cgroup</command> get or set value from the control
- group associated with the
- container <replaceable>name</replaceable>. If
- no <optional>value</optional> is specified, the value of
- the <replaceable>subsystem</replaceable> is displayed, otherwise
- it is set. The <command>lxc-cgroup</command> does not assume the
- correctness of the <replaceable>subsystem</replaceable> name, it
- is up to the user to specify the
- right <replaceable>subsystem</replaceable> name.
+ <command>lxc-cgroup</command> gets or sets the value of a
+ <replaceable>state-object</replaceable> (e.g., 'cpuset.cpus')
+ in the container's cgroup for the corresponding subsystem (e.g.,
+ 'cpuset'). If no <optional>value</optional> is specified, the
+ current value of the <replaceable>state-object</replaceable> is
+ displayed; otherwise it is set.
</para>
+ <para>
+ Note that <command>lxc-cgroup</command> does not check that the
+ <replaceable>state-object</replaceable> is valid for the running
+ kernel, or that the corresponding subsystem is contained in any
+ mounted cgroup hierarchy.
+ </para>
</refsect1>
<refsect1>
<varlistentry>
<term>
- <option><replaceable>subsystem</replaceable></option>
+ <option><replaceable>state-object</replaceable></option>
</term>
<listitem>
<para>
- Specify the subsystem control group name.
+ Specify the state object name.
</para>
</listitem>
</varlistentry>
</term>
<listitem>
<para>
- Specify the subsystem control group value to be set.
+ Specify the value to assign to the state object.
</para>
</listitem>
</varlistentry>
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, '.');
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;
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,
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;
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 {
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;
}