lxc_cgroup.c revision 6edbfc86508fb07d2b8377dce40f36f3032c32a5
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher * lxc: linux Container library
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher * (C) Copyright IBM Corp. 2007, 2008
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher * Daniel Lezcano <daniel.lezcano at free.fr>
531661c7bb54eb71853977a64cb30f80c20b963eJakub Hrozek * This library is free software; you can redistribute it and/or
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher * modify it under the terms of the GNU Lesser General Public
b47fd11a259c50e63cd674c7cba0da3f2549cae0Jakub Hrozek * License as published by the Free Software Foundation; either
ad805face83ba7d67b1cf2067a1982c7e63d1060Jakub Hrozek * version 2.1 of the License, or (at your option) any later version.
a7797068c4deb6ce2bdbcda27c45ff1bbb4a8e78Jakub Hrozek * This library is distributed in the hope that it will be useful,
a7797068c4deb6ce2bdbcda27c45ff1bbb4a8e78Jakub Hrozek * but WITHOUT ANY WARRANTY; without even the implied warranty of
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher * Lesser General Public License for more details.
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher * You should have received a copy of the GNU Lesser General Public
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub Hrozek * License along with this library; if not, write to the Free Software
36b56482ca1e53d832accef0354124fd79711172Jakub Hrozek * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagherstatic int my_checker(const struct lxc_arguments* args)
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher--name=NAME state-object [value]\n\
b355dcb54194f498921743ca33304eac35d89718Stephen GallagherGet or set the value of a state object (for example, 'cpuset.cpus')\n\
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagherin the container's cgroup for the corresponding subsystem.\n\
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher -n, --name=NAME container name",
b47fd11a259c50e63cd674c7cba0da3f2549cae0Jakub Hrozek if (lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
b47fd11a259c50e63cd674c7cba0da3f2549cae0Jakub Hrozek my_args.progname, my_args.quiet, my_args.lxcpath[0]))
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
b355dcb54194f498921743ca33304eac35d89718Stephen Gallagher ERROR("Insufficent privileges to control %s:%s", my_args.lxcpath[0], my_args.name);
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher ERROR("'%s:%s' is not running", my_args.lxcpath[0], my_args.name);
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher if (!c->set_cgroup_item(c, state_object, value)) {
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher ERROR("failed to assign '%s' value to '%s' for '%s'",
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher int ret = c->get_cgroup_item(c, state_object, buffer, len);
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher ERROR("failed to retrieve value of '%s' for '%s:%s'",