summaryrefslogtreecommitdiffstats
path: root/wrapper.c
Commit message (Collapse)AuthorAgeFilesLines
* libcgroup: Bug fix in libcgroup wrapper apiDhaval Giani2008-11-181-0/+4
| | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> The issue no 2309126 reported on sf.net tracker is fixed by this patch. This patch fixes a segmentation fault in cgroup_free_controllers() wrapper, which is generated when a Null cgroup is passed to the wrapper. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@222 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Check for NULL data structures in the wrappersDhaval Giani2008-09-051-0/+42
| | | | | | | | | | | Don't want to have a segmentation fault for NULL data structures. Just return an error to the caller. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@177 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Change variables to *printf/*scanf to use inttypes.hDhaval Giani2008-09-051-7/+7
| | | | | | | | | | | | | | | Instead of using %lu and so on, use the inttype.h macro to define types. Will ensure compatibility across platforms. Please review more closely. Tested by compiling with and without -m32 on a 64 bit system. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@176 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* This patch adds cgroup_create_cgroup_from_parent() API. I've tested itBalbir Singh2008-08-221-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: zero out allocated memoryDhaval Giani2008-08-141-27/+25
| | | | | | | | | | | | | Use calloc to allocate memory. Should get rid of a number of silent memory corruptions. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Acked-by: Dan Smith <danms@us.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@142 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Add cgroup_?et_value_* APIsDhaval Giani2008-08-121-0/+194
| | | | | | | | | | | | 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-7/+29
| | | | | | | | | | | | | | | 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/+62
| | | | | | | | | | | 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: Fix the wrapper warningsDhaval Giani2008-08-091-2/+3
| | | | | | | | | | | | | | | | | Fixes the following warnings wrapper.c: In function ‘cgroup_add_value_int64’: wrapper.c:152: warning: format ‘%lld’ expects type ‘long long int’, but argument 4 has type ‘int64_t’ wrapper.c:152: warning: format ‘%lld’ expects type ‘long long int’, but argument 4 has type ‘int64_t’ wrapper.c: In function ‘cgroup_add_value_uint64’: wrapper.c:186: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 4 has type ‘u_int64_t’ wrapper.c:186: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 4 has type ‘u_int64_t’ Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@122 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Fix index values in cgroup_add_value_*Dhaval Giani2008-08-091-8/+4
| | | | | | | | | | | | | | | | There is a horrible bug in wrapper.c. The loop was causing a segmentation fault. This is because we were checking for index value as opposed to i. This bug was not hit before, because in all our testing, we were trying out only with CONFIG_FAIR_GROUP_SCHED and we were setting only one value inside the memory subsystem. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@121 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Fix segmentation fault in APIs.Dhaval Giani2008-06-111-2/+0
| | | | | | | | | | | | | | | | | Dan Smith reported some segmentation faults. It turns out that we did not NULL terminate all the structures when we had moved to the wrapper based approach. With this in mind, the loop checks the index instead of a NULL structure. Also remove unwanted NULL terminations. Thanks to Dan for excellent debugging. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1c@77 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Add v0.1b tagBalbir Singh2008-05-241-0/+236
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@49 4f4bb910-9a46-0410-90c8-c897d4f1cd53