summaryrefslogtreecommitdiffstats
path: root/src/tools
Commit message (Collapse)AuthorAgeFilesLines
* Add cgdelete toolJan Safranek2009-07-292-1/+147
| | | | | | | | The cgdelete command line tool removes given control groups. Usage: cgdelete [-r] <controllers>:<group> [...] Signed-off-by: Jan Safranek <jsafrane@redhat.com>
* Fix too many program name in the usage message of "cgset" command.Ken'ichi Ohmichi2009-06-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Hi, If compiling the latest code (8cc1d9743201cb9ae9a5286c898b9d47e318ed46), the following warning messages are printed. $ make [snip] cgset.c: In function 'usage': cgset.c:123: warning: too many arguments for format [snip] $ This patch fixes too many program name in the usage message of "cgset" command. Thanks Ken'ichi Ohmichi Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* cgset: Add --copy-from option to cgsetIvana Varekova2009-06-291-5/+69
| | | | | | | Add copy-from option to cgset Signed-off-by: Ivana Varekova <varekova@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* cgset: Change the handling of options, add --helpIvana Varekova2009-06-291-6/+35
| | | | | | | | | | Change the handling of options - add the possibility to use long options - add --help option - change the type of c (see man 3 getopt_long) Signed-off-by: Ivana Varekova <varekova@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* cgset: Change the generation of cgroupIvana Varekova2009-06-291-43/+74
| | | | | | | | | | | | | | | - This patch change the system of generating cgroup to 1/ create one src cgroup 2/ for each input cgroup name cgroup_copy_cgroup the name-value data from original one This method is better because the name-values pairs should not be parsed several times. And this method will be used in new coption --copy-from too (the src group will be find in option) move the part in which src is generated to separate function Signed-off-by: Ivana Varekova <varekova@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* cgset: Add cgset_SOURCES to MakefileIvana Varekova2009-06-291-0/+2
| | | | | | | Add cgset_SOURCES to Makefile Signed-off-by: Ivana Varekova <varekova@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Apply a new rule to 'cgclassify' command.Ken'ichi Ohmichi2009-06-291-13/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi, Changelog of v6: ================ * Change the cgroup_get_procname_from_procfs() calling for the returning value's change. Changelog of v5: ================ * Add the description of a new option "--sticky". Changelog of v4: ================ * Add a new option "--sticky" so that cgrulesengd daemon does not change the children's cgroups which is classified by 'cgclassify' command. Changelog of v3: ================ * New patch. Description: ============ This patch applies a new rule to 'cgclassify' command. Thanks Ken'ichi Ohmichi Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Apply a new rule to 'cgexec' command.Ken'ichi Ohmichi2009-06-292-8/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi, Changelog of v6: ================ * No change. Changelog of v5: ================ * Add the description of a new option "--sticky". Changelog of v4: ================ * Add a new option "--sticky" so that cgrulesengd daemon does not change the children's cgroups which is executed by 'cgexec' command. Changelog of v3: ================ * Set a SETUID to "cgexec" command file. * An euid is changed to the executing user from a root user. Changelog of v2: ================ * New patch. Description: ============ This patch applies a new rule to 'cgexec' command. cgroup_register_unchanged_process() is called so that cgrulesengd daemon does not change the cgroup of a process, which is executed by 'cgexec' command. And cgroup_change_cgroup_flags() is called for applying a new rule. Thanks Ken'ichi Ohmichi Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* libcgroup: Introduce a unload cgroups APIDhaval Giani2009-06-222-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | This API will unload the cgroups created in the cgroupfs and unmount and delete the filesystem mount point. The action is equivalent to what is done currently in service cgconfig stop. The reason for this API is to make sure we don't end up with a asymmetric library API subset. Today an application program can programatically through cgroup_config_load_config() load a configuration file, but has no means to cleanup (including all temporarily created groups). changes from v3 1. Address Jan's comments from http://article.gmane.org/gmane.comp.lib.libcg.devel/1105 changes from v2 1. Fix a leak as noted by Bharata 2. Address Balbir's review comments at http://article.gmane.org/gmane.comp.lib.libcg.devel/1080 changes from v1 1. Change the name of the function to cgroup_unload_cgroups 2. Change the name of the executatble to cgclear 3. Split out the funtions Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* This patch adds cgset toolIvana Varekova2009-06-182-1/+179
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds cgset tool, which sets parameters of controllers for given cgroup based on input name-variable pairs - the syntax is: cgset -r <name=value> <relative path to cgroup> ------------------------------------------------- EXAMPLES: $ cgcreate -g cpuset:test1 $ cgset -r cpuset.cpus=1 test $ cat ./test/cpuset.cpus 1 $ cgcreate -g cpuset:test1 -g cpuset:test2 $ cgset -r cpuset.cpus=0 test1 test2 $ cat /mnt/cgroups/cpuset/test1/cpuset.cpus 0 $ cat /mnt/cgroups/cpuset/test2/cpuset.cpus 0 Signed-off-by: Ivana Varekova <varekova@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Cleanup: Integrate similar code to cgroup_get_uid_gid_from_procfs().Ken'ichi Ohmichi2009-06-081-84/+3
| | | | | | | | | | | | | | CHANGELOG of v2.1: ================ * Rebase the patch for commit '340feae163c4797a6cb1247b3812c1ccdc52fa41'. There are some similar functions for getting process's data (uid, gid) from /proc/<pid>/status file, so this patch integrates these functions into one cgroup_get_uid_gid_from_procfs(). Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Reviewed-By: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* This patch adds cgcreate toolIvana Varekova2009-06-032-1/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds cgcreate tool, which creates cgroups based on input parameters - the syntax is: cgcreate -t <tuid>:<tgid> -a <agid>:<auid> -g <list of controllers>:<relative path to cgroup> where: -a enables user to define admin gid and uid (implicit values are the same values which are in the parent directory) -t enables user to define task gid and uid (implicit values are the same values which are in parent directory) -g sets pairs list of controllers-relative path to cgroup ------------------------------------------------- EXAMPLES: * ../../libtool --mode=execute ./cgcreate -a :varekova -g cpuacct:first * ll /mnt/cgroups/cpuacct | grep first drwxrwxr-x 2 root varekova 0 2009-06-03 09:14 first * ll /mnt/cgroups/cpuacct/first/* -rwxrwxr-x 1 root varekova 0 2009-06-03 09:14 /mnt/cgroups/cpuacct/first/cpuacct.usage -rwxrwxr-x 1 root varekova 0 2009-06-03 09:14 /mnt/cgroups/cpuacct/first/notify_on_release -rwxrwxr-x 1 root varekova 0 2009-06-03 09:14 /mnt/cgroups/cpuacct/first/tasks * ../../libtool --mode=execute ./cgcreate -a varekova:root -t varekova:varekova -g cpuacct:second * ll /mnt/cgroups/cpuacct/ | grep second drwxrwxr-x 2 varekova root 0 2009-06-03 09:13 second * ll /mnt/cgroups/cpuacct/second total 0 -rwxrwxr-x 1 varekova root 0 2009-06-03 09:13 cpuacct.usage -rwxrwxr-x 1 varekova root 0 2009-06-03 09:13 notify_on_release -rwxrwxr-x 1 varekova varekova 0 2009-06-03 09:13 tasks * ../../libtool --mode=execute ./cgcreate -a varekova:varekova -g cpuacct:third -g cpuacct:fourth * ll /mnt/cgroups/cpuacct | grep h drwxrwxr-x 2 varekova varekova 0 2009-06-03 09:18 fourth drwxrwxr-x 2 varekova varekova 0 2009-06-03 09:18 third * ll /mnt/cgroups/cpuacct/*h* /mnt/cgroups/cpuacct/fourth: total 0 -rwxrwxr-x 1 varekova varekova 0 2009-06-03 09:18 cpuacct.usage -rwxrwxr-x 1 varekova varekova 0 2009-06-03 09:18 notify_on_release -rwxrwxr-x 1 varekova varekova 0 2009-06-03 09:18 tasks /mnt/cgroups/cpuacct/third: total 0 -rwxrwxr-x 1 varekova varekova 0 2009-06-03 09:18 cpuacct.usage -rwxrwxr-x 1 varekova varekova 0 2009-06-03 09:18 notify_on_release -rwxrwxr-x 1 varekova varekova 0 2009-06-03 09:18 tasks Signed-off-by: Ivana Varekova <varekova@redhat.com>
* Add cgroup_free_group_spec procedureIvana Varekova2009-05-292-0/+32
| | | | | | | | Add cgroup_free_group_spec procedure which free cgroups_group_spec variable. Signed-off-by: Ivana Varekova <varekova@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* parse_cgroup_spec function does not initializesd allocated memoryIvana Varekova2009-05-291-1/+1
| | | | | | | | | parse_cgroup_spec function does not initializesd allocated memory this patch allocate it to zero so there is no problem with uninitialized values. Signed-off-by: Ivana Varekova <varekova@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Add options to enable/disable various build targets.Jan Safranek2009-05-251-0/+4
| | | | | | | | | | | | | By default, everything is compiled. I want to add options to ./configure, which can selectively disable tools, daemon and pam module. The library itself is mandatory component and cannot be disabled. Usage: ./configure --help ./configure --disable-tools --disable-pam --disable-daemon Signed-off-by: Jan Safranek <jsafrane@redhat.com>
* Add fclose() calls into egid_of_pid().Ken'ichi Ohmichi2009-05-181-0/+2
| | | | | | | | | | | | | Hi, This patch adds necessary fclose() calls into egid_of_pid(). Thanks Ken'ichi Ohmichi Reported-by: Masayuki Igawa <igawa@mxs.nes.nec.co.jp> Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Fix of cgexec error handlingIvana Varekova2009-05-081-1/+2
| | | | | | | | | | | Fix of cgexec error handling - with this patch cgexec return the right error message - not only cg internal error value re-generated Signed-off-by: Ivana Varekova <varekova@redhat.com> Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Remove autogenerated files and update documentation. More documentationBalbir Singh2009-04-011-519/+0
| | | | | | updates will be needed and will be done in subsequent cleanups. Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* Add fclose() calls for error handlingKen'ichi Ohmichi2009-03-311-0/+2
| | | | | | | | | I reviewed the libcgroup code in the viewpoint of memory-leak and found some lacks of fclose(). This patch adds some fclose() calls for error handling. Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Rework the way how so version is definedJan Safranek2009-03-261-3/+5
| | | | | | | | | Make the shared object version a bit more usable, the notation with double colons cannot be used on different places (see next patch). Also run automake && autoconf to refresh the generated stuff. Signed-off-by: Jan Safranek <jsafrane@redhat.com>
* Install cgconfigparser to /sbinJan Safranek2009-03-262-21/+53
| | | | | | | | | cgconfigparser can be executed only by root, so it should be installed to /sbin directory. Also run automake to update Makefile.in with this change. Signed-off-by: Jan Safranek <jsafrane@redhat.com>
* Generate everythingautomakeJan Safranek2009-03-261-0/+486
| | | | | | Finally run autoreconf -f -i to generate all the stuff that should be generated Signed-off-by: Jan Safranek <jsafrane@redhat.com>
* Add automake makefilesJan Safranek2009-03-261-0/+11
| | | | | | | | Add automake makefiles and prepare everything to run, but don't actually run the automake - it would generate lot of noise, where my manual changes would get lots. Signed-off-by: Jan Safranek <jsafrane@redhat.com>
* Distribute files to various subdirectoriesJan Safranek2009-03-265-0/+557
Signed-off-by: Jan Safranek <jsafrane@redhat.com>