summaryrefslogtreecommitdiffstats
path: root/libcgroup.h
Commit message (Collapse)AuthorAgeFilesLines
* libcgroup: Better error reporting for libcgroupDhaval Giani2008-12-091-0/+7
| | | | | | | | | | | | | | | | From: Ankita Garg <ankita@in.ibm.com> This patch adds human readable error messages to the configuration parser. The error lookup is implemented as a simple table, indexed by the error. TODO: Save errno at ECGOTHER and pass it down as cgroup_lasterror. Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Ankita Garg <ankita@in.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@228 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Change how cgroup_get_cgroup worksDhaval Giani2008-09-291-1/+1
| | | | | | | | | | | | | | Since we will not deprecate API now, and will do so with the next release, let's include this one in and get the API right. With this pathc, we now return int type, and the pointer passed as the argument redirects to the cgroup we are reading. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@202 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Configuration rewrite to use the main cgroups API and several bug fixesBalbir Singh2008-09-291-75/+5
| | | | | | | | | | | | | and configuration enhancements. Primarliy Initiated by Dhaval Giani Please see svn log of all branches/balbir-config-cleanup Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@201 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* The automatic classification engine (cgexec, cgclassify, pam_cgroup)Balbir Singh2008-09-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | classify tasks. It is useful for an application to know where it has been classified. I propose to add a new API cgroup_get_current_controller_path() that returns the current classification directory for the specified controller. One can easily add on and build new API that will return paths of all mounted controllers, but I want to start with something simple and useful. I've also added a bunch of test cases for the same purpose. Test output # ./pathtest.sh Test FAIL, get path failed for controller cpuset Test PASS, controller cpu path /default Test PASS, controller cpuacct path /default Test PASS, controller memory path /default Test FAIL, get path failed for controller memrlimit I mounted just cpu, cpuacct and memory, thus the path for cpuset and memrlimit could not be found (as expected). Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Reviewed-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@200 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Merge the cgruleseng daemon from Steve OlivieriBalbir Singh2008-09-261-1/+78
| | | | | | | | | | Signed-off-by: Steve Olivieri <sjo@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@190 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* This patch adds cgroup_create_cgroup_from_parent() API. I've tested itBalbir Singh2008-08-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with a modified version of libcg_ba (basic acceptance tests), that I'll send out later. I've also fixed a couple of bugs, I'll list them in order and if desired, I'll split out the patches so that the enhancements can be separate from the bug fixes 1. Fix cg_create_control_group() to succeed if the directory already exists 2. We can't always append a control_file, we need to open it "r+" 3. It's OK for writing values to a control_file to fail, since some of them are read-only and some may not exist in hierarchies below the root 4. Skip over directories while trying to read control file's name value pairs 5. In cg_rd_ctlr_file we don't allocate any memory to value, directly fscanf into it, that's been fixed 6. There might be more fixes that might already be present in trunk, since I hope I've not redone a lot of the fixes, I had branched of trunk very recently Changelog v2 ------------ 1. Refactor cgroup_free_controllers() and use it in cgroup_create_cgroup_from_parent() 2. Check for strdup failure 3. Check if dst == src TODO: 1. Use cg_add_controller() API 2. Use cg_add_value_string() API I'll send out patches for the TODOs later. I've also updated the basic acceptance test (libcg_ba.cpp) Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@165 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Some libcgroup API cleanupsDhaval Giani2008-08-151-0/+5
| | | | | | | | | | | Various libcgroup api cleanups as suggested by balbir during code review Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@159 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: New API interfaces for task placementDhaval Giani2008-08-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | From: Vivek Goyal <vgoyal@redhat.com> Enhancement to libcg to do following. - Parse the /etc/cgrules.conf file and place the task in the right cgroup. - Exported two APIs which can place the task based on /etc/cgrules.conf or based on cgroup explicitly specified by the caller. - There can be multiple users. - PAM module (pam_cgroup) - cgexec tool - cgclassify tool - APIs can be directly used by other cgroup aware user progarams. - Classification daemon Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@136 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Configuration and parsing updates (v2)Dhaval Giani2008-08-131-1/+1
| | | | | | | | | | | | | | | | | | | | | Dhaval, wanted a patch with -p1 generated so that he can apply it and use it with quilt. Here goes Testing Tested with samples/cgconfig.conf (NOTE: expects user balbir to be present on the system, feel free to change and test). TODO 1. Add hooks for other controllers, namely memory, cpuacct and cpuset Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@134 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Add cgroup_?et_value_* APIsDhaval Giani2008-08-121-0/+16
| | | | | | | | | | | | Adding in APIs which allow you to set and get values from a cgroup controller. Use cgroup_get_controller to get a controller, and then use cgroup_?et_value_* API for your requirement. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@126 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Add API to get the cgroup from name (Breaks existing API)Dhaval Giani2008-08-121-2/+5
| | | | | | | | | | | | | | | This patch breaks API. There are no known users at the moment so it is fine. cgroup_new_cgroup now takes in only a name argument. The uids and gids are set by a new API, cgroup_?et_uid_gid() Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@125 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Add an API to allow comparision of cgroupsDhaval Giani2008-08-121-0/+5
| | | | | | | | | | | Allows you to compare two cgroups. Their values need to be equal. NULL cgroups are invalid. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@124 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Add new API to get cgroup data structure from filesystemDhaval Giani2008-08-061-0/+1
| | | | | | | | | | | | | | | | | New API to get the cgroup datastructure from the mounted filesystem. It accepts the cgroup datastructure with the name of the cgroup which has to populated across various mountpoints. TODO: More testing. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Cc: Dan Smith <danms@us.ibm.com> Cc: Paul Menage <menage@google.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@117 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Introduce new error code ECGOTHERDhaval Giani2008-07-291-0/+4
| | | | | | | | | | | | From: Vivek Goyal <vgoyal@redhat.com> Introduce new error code ECGOTHER Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@116 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: fix return value in cg_set_conrol_valueDhaval Giani2008-07-211-0/+1
| | | | | | | | | | We don't want to return errno as those results. Setting it to return a libcgroup error value. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@108 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* From: Sudhir Kumar <sudhir@linux.vnet.ibm.com>Dhaval Giani2008-07-011-1/+1
| | | | | | | | | | | This patch fixes the spell mistake in enum value in the header file and libcg api file. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@84 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Some bugs were missed in v0.1b. Fixing those bugs and taggingDhaval Giani2008-06-101-0/+1
| | | | | | | | | v0.1c. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1c@76 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Fix api.c warnings, include wrapper.c in Makefile. More changes toBalbir Singh2008-05-301-0/+1
| | | | | | | | | | | spec file based on bugzilla input. Removed %makeinstall Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@67 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Add v0.1b tagBalbir Singh2008-05-241-0/+179
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@49 4f4bb910-9a46-0410-90c8-c897d4f1cd53