summaryrefslogtreecommitdiffstats
path: root/api.c
Commit message (Collapse)AuthorAgeFilesLines
* libcgroup: check for return code of fprintf()Dhaval Giani2008-08-131-4/+30
| | | | | | | | | | | | | | | | | From: Vivek Goyal <vgoyal@redhat.com> o Adding a task to a particular cgroup currently does fprintf() and never check the return code. Modify it to check for the return code in case fprintf() and fflush() did not succeed. o I ran into the issues when i can't add migration thread to /container/admingroup/tasks and it will fail silently. 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@133 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Extend cgroup_get_cgroup for uids as well.Dhaval Giani2008-08-121-3/+55
| | | | | | | | | | | | Now that a new API is available which allows a cgroup structure to be generated with just a name, extend cgroup_get_cgroup to get the uids and gids from the fs itself. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@127 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Fix segmentation fault in cgroup_init() -take2Dhaval Giani2008-08-091-2/+6
| | | | | | | | | | | | | | | | An artifact from the time when libcgroup could not handle multiple cgroup filesystems mounted at multiple points. It is very much possible a subsystem is not mounted at that point. (FWIW, it is wrong even on a single mount point, but I am quite surprised that no one hit it yet.) V1->V2 A minor cleanup possible. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@120 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Add new API to get cgroup data structure from filesystemDhaval Giani2008-08-061-0/+153
| | | | | | | | | | | | | | | | | 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: Add more debug statementsDhaval Giani2008-07-291-4/+14
| | | | | | | | | | | | From: Vivek Goyal <vgoyal@redhat.com> o Add some more debug statements 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@115 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Fix up rentrant functions patch.Dhaval Giani2008-07-231-3/+17
| | | | | | | | | | Some errors were not handled, this patch handles those errors. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@114 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Ensure global data is protectedDhaval Giani2008-07-211-13/+44
| | | | | | | | | | | Add rwlock to ensure access to cg_mount_table is serialized. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Vivek Goyal <vgoyal@redhat.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@110 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Make libcgroup use rentrant functionsDhaval Giani2008-07-211-5/+15
| | | | | | | | | | | | | | | This patch converts functions which have reentrant versions to use those versions. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Paul Menage <menage@google.com> Cc: Dan Smith <danms@us.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@109 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: fix return value in cg_set_conrol_valueDhaval Giani2008-07-211-1/+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
* libcgroup: Fix segmentation fault in cgroup_attach_task_pidDhaval Giani2008-07-081-1/+1
| | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch fixes the segmentation fault in libcg api cgroup_attach_task() in case of multiple mounts. Signed-off-by: Sudhir Kumar <skumar@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@103 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: Handle null cgroups in APIsDhaval Giani2008-07-081-0/+9
| | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> [dhaval@linux.vnet.ibm.com]: correct error codes Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@102 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* From: Sudhir Kumar <sudhir@linux.vnet.ibm.com>Dhaval Giani2008-07-011-4/+4
| | | | | | | | | | | 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
* libcgroup: Fix segmentation fault in APIs.Dhaval Giani2008-06-111-20/+13
| | | | | | | | | | | | | | | | | 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
* Some bugs were missed in v0.1b. Fixing those bugs and taggingDhaval Giani2008-06-101-6/+60
| | | | | | | | | 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 more api.c warningsBalbir Singh2008-05-301-4/+12
| | | | | | | | Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@68 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Fix api.c warnings, include wrapper.c in Makefile. More changes toBalbir Singh2008-05-301-29/+7
| | | | | | | | | | | 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-22/+29
| | | | git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@49 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Multiple mount point support. Patches built on top of Dhaval'a patches.Balbir Singh2008-05-171-102/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Works for me on my testing. NOTE: The testing is insufficient as we only test cg_control_create_cgroup() and not delete_cgroup() or attach_task(). Sudhir's new test cases should really help Several coding style fixes and changes, enhancements to make the code work. NOTE: Since this is development release -DDEBUG is back in the makefile. Once this is committed, I'll bump up the version to 0.05 if no one objects. Test report ----------- debug log from the library matched cpuacct:cpuacct Found cgroup option rw,relatime,cpuacct, count 0 matched cpu:cpu Found cgroup option rw,relatime,cpu, count 1 tuid 0, tgid 0, cuid 1000, cgid 1000 path is /tmp/container_cpu/database/ path is /tmp/container_cpuacct/database/ NOTE: The database directory was created as expected on both mount points /tmp/container_cpu and /tmp/container_cpuacct balbir@localhost:~/deliverables/nextgen/libcg/branches/balbir/tests$ ls -al /tmp/container_cpuacct/ total 424 drwxrwxrwt 5 root root 0 2008-05-17 21:27 . drwxrwxrwt 32 root root 425984 2008-05-17 21:26 .. drwxr-xr-x 2 root root 0 2008-05-17 17:09 class1 drwxr-xr-x 2 balbir balbir 0 2008-05-17 17:09 class2 -rw-r--r-- 1 root root 0 2008-05-17 17:09 cpuacct.usage drwxr-xr-x 2 balbir balbir 0 2008-05-17 21:27 database -rw-r--r-- 1 root root 0 2008-05-17 17:09 notify_on_release -rw-r--r-- 1 root root 0 2008-05-17 17:09 releasable -rw-r--r-- 1 root root 0 2008-05-17 17:09 release_agent -rwxrwxrwx 1 root root 0 2008-05-17 17:09 tasks balbir@localhost:~/deliverables/nextgen/libcg/branches/balbir/tests$ ls -al /tmp/container_cpu total 424 drwxrwxrwt 5 root root 0 2008-05-17 21:27 . drwxrwxrwt 32 root root 425984 2008-05-17 21:26 .. drwxr-xr-x 2 root root 0 2008-05-17 17:09 class1 drwxr-xr-x 2 balbir balbir 0 2008-05-17 17:09 class2 -rw-r--r-- 1 root root 0 2008-05-17 17:09 cpu.rt_runtime_us -rw-r--r-- 1 root root 0 2008-05-17 17:09 cpu.shares drwxr-xr-x 2 balbir balbir 0 2008-05-17 21:27 database -rw-r--r-- 1 root root 0 2008-05-17 17:09 notify_on_release -rw-r--r-- 1 root root 0 2008-05-17 17:09 releasable -rw-r--r-- 1 root root 0 2008-05-17 17:09 release_agent -rwxrwxrwx 1 root root 0 2008-05-17 21:10 tasks 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/branches/balbir@30 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Remove merge comments and left overs from previous mergeBalbir Singh2008-05-111-15/+0
| | | | | | | | Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@27 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Merge with Dhaval's branchBalbir Singh2008-05-111-3/+16
| | | | | | | | | Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@26 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* chown recursive routines need to return zero on successBalbir Singh2008-04-211-3/+3
| | | | | | | | Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@19 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Miscellaneous scripts and libcg bug fixesBalbir Singh2008-04-181-2/+5
| | | | | | | | | | | | Turn off -DDEBUG in Makefile Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@18 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* api.c | 23 +++++++++++++++--------Balbir Singh2008-04-161-8/+15
| | | | | | | | | | | | | | libcg.h | 4 ++-- tests/libcg_ba.cpp | 2 +- Added additional parameters for create and destroy cgroup. Fixed a cg_init segfault (faulty, if-else check) Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@15 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Got recursive chown to work. API needs more changes to be able to ignoreBalbir Singh2008-04-121-7/+9
| | | | | | | | | | | | | ownership arguments. api.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@13 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Several bug fixes, some API enhancements.Balbir Singh2008-04-111-28/+133
| | | | | | | | | | | | | | | | | The first basic acceptance test is under development and first prototype is released api.c | 161 +++++++++++++++++++++++++++++++++++++++++++---------- libcg.h | 14 +--- tests/Makefile | 9 ++ tests/libcg_ba.cpp | 127 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 274 insertions(+), 37 deletions(-) Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@12 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* This patch fixes file handle leaks as noticed by Paul Menage.Balbir Singh2008-04-101-20/+8
| | | | | | | | | Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@8 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* This patch modifies libcg to use the new cgroup data structure.Balbir Singh2008-04-071-80/+70
| | | | | | | | | | Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> The code is yet to be tested though git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@7 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* Dhaval's API changes, phase 1, prototypeBalbir Singh2008-04-051-0/+347
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@4 4f4bb910-9a46-0410-90c8-c897d4f1cd53