]> git.ipfire.org Git - thirdparty/libcgroup.git/log
thirdparty/libcgroup.git
16 years agolibcgroup: create function for cgroup_delete_cgroup
Dhaval Giani [Mon, 22 Dec 2008 18:58:11 +0000 (18:58 +0000)] 
libcgroup: create function for cgroup_delete_cgroup

From: Sudhir Kumar <skumar@linux.vnet.ibm.com>

This patch creates the function test_cgroup_delete_cgroup(), to delete a
group in fs, and this way eliminates lot of redundant code. This patch
however may mesh up the numbering of testcases, which will be cleaned up
in a later patch once the functions are created for all other apis too.

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@287 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: create function for cgroup_create_cgroup
Dhaval Giani [Mon, 22 Dec 2008 18:56:50 +0000 (18:56 +0000)] 
libcgroup: create function for cgroup_create_cgroup

From: Sudhir Kumar <skumar@linux.vnet.ibm.com>

This patch creates the function test_cgroup_create_cgroup(), to create a
group in fs from a cgroup structure, and this way eliminates lot of redundant
code. This patch however may mesh up the numbering of testcases, which will
be cleaned up in a later patch once the functions are created for all other
apis.

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@286 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: adds warning messages in libcgroup testcases
Dhaval Giani [Mon, 22 Dec 2008 18:55:33 +0000 (18:55 +0000)] 
libcgroup: adds warning messages in libcgroup testcases

From: Sudhir Kumar <skumar@linux.vnet.ibm.com>

This patch adds few more warning messages in the message pool

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@285 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: cleanup: remove redundant parameter to function
Dhaval Giani [Mon, 22 Dec 2008 18:53:49 +0000 (18:53 +0000)] 
libcgroup: cleanup: remove redundant parameter to function

From: Sudhir Kumar <skumar@linux.vnet.ibm.com>

There is no need to pass a separate variable for getting single/multiple
mount info, as we can get this info from the varaible received from script.
So this patch does that modification and puts the variaable fs_mounted as
global as it is never modified.

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@284 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: create function for cgroup_new_cgroup
Dhaval Giani [Mon, 22 Dec 2008 18:52:08 +0000 (18:52 +0000)] 
libcgroup: create function for cgroup_new_cgroup

From: Sudhir Kumar <skumar@linux.vnet.ibm.com>

This patch creates the function create_new_cgroup_ds(), to create a well
populated cgroup structure, and this way eliminates lot of redundant
code. This function internaly call other functions to provide a complete
cgroup structure. This patch breaks one of the testcases because of
the global data being used. I have fixed that in the dame patch to
maintain uniformity as this is a single line fix only and is well
commented in the code.

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@283 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: libcgroup testcases for cgroup_get_cgroup
Dhaval Giani [Mon, 22 Dec 2008 18:50:46 +0000 (18:50 +0000)] 
libcgroup: libcgroup testcases for cgroup_get_cgroup

From: Sudhir Kumar <skumar@linux.vnet.ibm.com>

This atch adds a new testcase for api cgroup_get_cgroup()
for single mount case.

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@282 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: libcgroup testcases for compare_cgroup
Dhaval Giani [Mon, 22 Dec 2008 18:49:15 +0000 (18:49 +0000)] 
libcgroup: libcgroup testcases for compare_cgroup

From: Sudhir Kumar <skumar@linux.vnet.ibm.com>

This patch adds a testcase for cgroup_compare_cgroup() wrapper.

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@281 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test:
Balbir Singh [Wed, 17 Dec 2008 15:24:07 +0000 (15:24 +0000)] 
libcgroup Test:

Minor cleanups.

Signed-off-by: Sudhir KUmar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@280 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: add message
Balbir Singh [Wed, 17 Dec 2008 15:23:42 +0000 (15:23 +0000)] 
libcgroup Test: add message

This patch fixes the NUM_MSGS error which was still 10, however there
are more type of messages to be printed. It also adds the support to just
print a new line in case there is no message to be printed.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@279 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: change control value
Balbir Singh [Wed, 17 Dec 2008 15:23:16 +0000 (15:23 +0000)] 
libcgroup Test: change control value

This patch changes the control values to be written to control file.
The write of value 7000000 to memory.limt_in_bytes resulted in a silent
write of 7000064, because of which modify() test case was failing.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@278 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: address earlier comments
Balbir Singh [Wed, 17 Dec 2008 15:22:50 +0000 (15:22 +0000)] 
libcgroup Test: address earlier comments

This patch addresses the comments on testcases sent earlier.
Some of the corrections have been made in the coming patches which create
functions to test an api under different scenarios. The simple reason behind
that is to avoid the patches that contain only noise. For ex const strn* warnings.

I got one of the comments from Balbir Singh
"I wonder if we should also verify the
cgroup_modify_cgroup() changes by reading back the values using
cgroup_get_cgroup()"
I have not used this approach for now because of two reasons(however it would
have made life easy for me :))
1. In case cgroup_get_cgroup() fails, cgroup_modify_cgroup() test also will fail.
2. If cgroup_get_cgroup() becomes deprecated or dropped, then the testcase will
become obsolete. However I am still open to the idea. Your thoughts again??

Second comment was
"Each test case needs to be an induvidual function (can be called
from threads or other processes via a library interface)"
And the coming patches do that.

The next imp comment for me was
"I'll try and find a good test case infrastructure, if one exists
that can meet our needs."
I am eager to see some tool like that.

TODO:
Removing the hard coding of control values using config file is under progress

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@277 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: suppress-string-constant-warnings-in-compilation
Balbir Singh [Wed, 17 Dec 2008 15:22:26 +0000 (15:22 +0000)] 
libcgroup Test: suppress-string-constant-warnings-in-compilation

The following patch removes the string to char * conversion warnings.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@276 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: change error value to be checked
Balbir Singh [Wed, 17 Dec 2008 15:21:57 +0000 (15:21 +0000)] 
libcgroup Test: change error value to be checked

Chanhe the error values as per the change in APIs
Signed-off-by:  Sudhir Kumar  <skumar@linux.vnet.ibm.com>

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@275 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgroup-split-new-cgroup-function
Balbir Singh [Wed, 17 Dec 2008 15:21:32 +0000 (15:21 +0000)] 
libcgroup Test: libcgroup-split-new-cgroup-function

This patch splits the earlier created function new_cgroup() into two
to make it more useful for other testcases.

Signed-off-by:  Sudhir Kumar  <skumar@linux.vnet.ibm.com>

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@274 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgrouptest-fix-cntlr-order-error-in-script
Balbir Singh [Wed, 17 Dec 2008 15:21:02 +0000 (15:21 +0000)] 
libcgroup Test: libcgrouptest-fix-cntlr-order-error-in-script

Sometimes on some machines, encounterd an issue of getting the controllers
information in reverse order. So keeping the uniformity for future.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@273 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: fix-modify_cgroup-bug-in-multimnt
Balbir Singh [Wed, 17 Dec 2008 15:20:36 +0000 (15:20 +0000)] 
libcgroup Test: fix-modify_cgroup-bug-in-multimnt

this patch fixes the testcase for cgroup_modify_cgroup() multi mount.
The second controller was not initialised to a value, so doing that.
/me learns the bad effects of using global data structure :)

Signed-off-by:  Sudhir Kumar  <skumar@linux.vnet.ibm.com>

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@272 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: fix-STRING-typo
Balbir Singh [Wed, 17 Dec 2008 15:20:12 +0000 (15:20 +0000)] 
libcgroup Test: fix-STRING-typo

Fixing a typo.(Bad effect of yy p :))

Signed-off-by:  Sudhir Kumar  <skumar@linux.vnet.ibm.com>

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@271 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: fix-modify_cgroup-failures-by-changing-cntl-values
Balbir Singh [Wed, 17 Dec 2008 15:19:45 +0000 (15:19 +0000)] 
libcgroup Test: fix-modify_cgroup-failures-by-changing-cntl-values

Since the cpu.shares now has a max limit, this patch fixes all cgroup_modify_cgroup()
testcases that were failing because of this issue. This is not a permanent fix, however,
i will be changing the approach to use a configuration file for control values and
the patch will be out soon, once the function creation part is over.

Signed-off-by:  Sudhir Kumar  <skumar@linux.vnet.ibm.com>

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@270 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: fix-newly-broken-test
Balbir Singh [Wed, 17 Dec 2008 15:19:22 +0000 (15:19 +0000)] 
libcgroup Test: fix-newly-broken-test

The previous patch creating the function for attach_task() breaks a test case
because of global data usage. This patch fixes that.
(There will be functions corresponding to each API to test all the APIs)

Signed-off-by:  Sudhir Kumar  <skumar@linux.vnet.ibm.com>

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@269 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgroup-create-function-for-attach_task-api
Balbir Singh [Wed, 17 Dec 2008 15:18:56 +0000 (15:18 +0000)] 
libcgroup Test: libcgroup-create-function-for-attach_task-api

This patch creates a function test_cgroup_attach_task() to test the libcgroup
api cgroup_attach_task() under different scenario. In the earlier approach we
were not usong functions and were testing the api sequentialy under different
conditions. The new approach has a single function for 1 api which can handle
the testing under all conditions. The advantage is that the test case becomes
thread safe as all the variables are now declared on stack. The other benefit
is that the code repetition has reduced now.

Signed-off-by:  Sudhir Kumar  <skumar@linux.vnet.ibm.com>

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@268 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgroup-create-function-for-init-api
Balbir Singh [Wed, 17 Dec 2008 15:18:23 +0000 (15:18 +0000)] 
libcgroup Test: libcgroup-create-function-for-init-api

This patch creates a function test_cgroup_init() to test the libcgroup api
cgroup_init() under different scenario. In the earlier approach we were not
usong functions and were testing the api sequentialy under different conditions.
The new approach has a single function for 1 api which can handle the testing
under all conditions. The advantage is that the code repetition has reduced now.

Signed-off-by:  Sudhir Kumar  <skumar@linux.vnet.ibm.com>

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@267 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgroup-add-static-array-for-testcase-info-messages
Balbir Singh [Wed, 17 Dec 2008 15:17:57 +0000 (15:17 +0000)] 
libcgroup Test: libcgroup-add-static-array-for-testcase-info-messages

This patch removes all the strncpy() calls that were made before each api
call to print the info messages. This patch creates an array of such info
messages, initialize them, and then frees them with the help of two functions
set_info_msgs(), called at start and free_info_msgs() called at end. The
main motto has been to avoid the global variables due to thread safety reasons.

Signed-off-by:  Sudhir Kumar  <skumar@linux.vnet.ibm.com>

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@266 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgrouptest-fix-to-empty-extra-string-and-add-a-new-warning
Balbir Singh [Wed, 17 Dec 2008 15:17:24 +0000 (15:17 +0000)] 
libcgroup Test: libcgrouptest-fix-to-empty-extra-string-and-add-a-new-warning

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@265 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgroup-modify_cgroup-test3-for-multimnt
Balbir Singh [Wed, 17 Dec 2008 15:16:54 +0000 (15:16 +0000)] 
libcgroup Test: libcgroup-modify_cgroup-test3-for-multimnt

This patch adds a testcase for libcgroup api cgroup_modify_cgroup() for
commongroup (under two controllers) in multiple mount scenario.

Again the challenge is to handle the control value as diff controllers put diff
upper limit on control value and we pick the controller dynamicaly.
So thoughts ???

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@264 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgroup-modify_cgroup-test2-for-multimnt
Balbir Singh [Wed, 17 Dec 2008 15:16:20 +0000 (15:16 +0000)] 
libcgroup Test: libcgroup-modify_cgroup-test2-for-multimnt

This patch adds a testcase for libcgroup api cgroup_modify_cgroup() for
multiple mount scenario for second controller.

Again the challenge is to handle the control value as diff controllers put diff
upper limit on control value and we pick the controller dynamicaly.
So thoughts ???

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@263 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgroup-modify_cgroup-test1-for-multimnt
Balbir Singh [Wed, 17 Dec 2008 15:15:56 +0000 (15:15 +0000)] 
libcgroup Test: libcgroup-modify_cgroup-test1-for-multimnt

This patch adds a testcase for libcgroup api cgroup_modify_cgroup() for
multiple mount scenario for first controller.

The challenge is to handle the control value as diff controllers put diff
upper limit on control value and we pick the controller dynamicaly.
We are going to use a config file for that which will have the controller name,
control file name and the control value. But not sure if there is any better
approach.
So thoughts ???

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@262 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgroup-attach_task-test-for-cmmongrp-multimnt
Balbir Singh [Wed, 17 Dec 2008 15:15:25 +0000 (15:15 +0000)] 
libcgroup Test: libcgroup-attach_task-test-for-cmmongrp-multimnt

This patch adds a testcase for libcgroup api cgroup_attach_task() for
a common group in multiple mount scenario.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@261 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: fix-typo-error-in-delete-cgroup
Balbir Singh [Wed, 17 Dec 2008 15:14:45 +0000 (15:14 +0000)] 
libcgroup Test: fix-typo-error-in-delete-cgroup

This patch fixes a testcase which was having some typo errors.
(libcgroup api cgroup_delete_cgroup() for a common group in
multiple mount scenario)

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@260 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: make-controller-use-generic-in-binary
Balbir Singh [Wed, 17 Dec 2008 15:13:58 +0000 (15:13 +0000)] 
libcgroup Test: make-controller-use-generic-in-binary

This patch makes the use of controllers available from script more generic.
All possible controllers in Linux kernel are to be kept as enum parameters
and a corresponding mapping is done in both, the script and binary. The
testcases are no more hardcoded with respect to controllers. The function
set_controller() need to be updated with respect to the controllers and
control file.
The challenges yet to be solved are:
(1)Choosing appropriate control file
(2)Choosing appropriate control value dynamicaly.

Thoughts are most welcome.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@259 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: set-another-controller-if-first-fails
Balbir Singh [Wed, 17 Dec 2008 15:13:13 +0000 (15:13 +0000)] 
libcgroup Test: set-another-controller-if-first-fails

This patch adds a warning in case setting a controller fails and
tries to set values for another controller.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@258 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: put-commoncode-in-build-path-function
Balbir Singh [Wed, 17 Dec 2008 15:12:30 +0000 (15:12 +0000)] 
libcgroup Test: put-commoncode-in-build-path-function

This patch puts the common code into a function build_path()
and thus reduces lots of redundant lines of code.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@257 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: make-controller-check-generic
Balbir Singh [Wed, 17 Dec 2008 15:11:48 +0000 (15:11 +0000)] 
libcgroup Test: make-controller-check-generic

The following patch adds support for a dynamical check of controllers and
choosing two of them, which are enabled in the kernel. I have given preference
to the cpu and memory controller if they exist.

I will pass these mounted controllers to the c file(will send implementation in
a next patch) and thus the c file will have no hard coding with respect to any
controller. The reason of chosing script for this part is
1. easy to implement
2. otherwise there wont be any use of script :)

One of my doubts is:
Few controllers(e.g. devices) seems not to be having a control file. Please help
me in finding the control file for each controller. Any link to documentation?
This info I need in the c file.
As per my knowledge the control files are:
*****************************
controller control_file
*****************************
cpu cpu.shares
memory memory.linit_in_bytes
debug
devices
ns
cpuacct
cpuset

Also what type of values can be written to those control files?
I need to take care before i write something stupid to a control file.

Please review the patch and give your valuable comments.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@256 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgroup-attach_task-singlemount-testcase
Balbir Singh [Wed, 17 Dec 2008 15:11:00 +0000 (15:11 +0000)] 
libcgroup Test: libcgroup-attach_task-singlemount-testcase

Hi,
This patch adds a testcase for cgroup_attach_task() api for single mount.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@255 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: change test call
Balbir Singh [Wed, 17 Dec 2008 15:10:21 +0000 (15:10 +0000)] 
libcgroup Test: change test call

Hi,
The api cgroup_modify_cgroup(cgroup1) had to be called before
cgroup_modify_cgroup(cgroup2). This patch does that.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@254 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: add warnings
Balbir Singh [Wed, 17 Dec 2008 15:09:32 +0000 (15:09 +0000)] 
libcgroup Test: add warnings

Hi,
This patch adds some warnings in case some testcses fail.
When we modify a group with nullcgroup then there is no need to
check if values are changed.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@253 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: cleanup4
Balbir Singh [Wed, 17 Dec 2008 15:08:34 +0000 (15:08 +0000)] 
libcgroup Test: cleanup4

Hi,
This patch does printf and other cleanups in third set of testcases.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@252 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: fixed certain rejects
Balbir Singh [Wed, 17 Dec 2008 15:07:35 +0000 (15:07 +0000)] 
libcgroup Test: fixed certain rejects

The following patch makes certain cleanups for the patchset to apply without
any rejects. However the lines of code are being changed in one of the next
patches.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@251 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: cleanup3
Balbir Singh [Wed, 17 Dec 2008 15:06:33 +0000 (15:06 +0000)] 
libcgroup Test: cleanup3

Hi,
This patch does cleanups in test script.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@250 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: cleanup2
Balbir Singh [Wed, 17 Dec 2008 15:05:47 +0000 (15:05 +0000)] 
libcgroup Test: cleanup2

Hi,
This patch does printf and other cleanups in second set of testcases.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@249 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: cleanup1
Balbir Singh [Wed, 17 Dec 2008 15:04:52 +0000 (15:04 +0000)] 
libcgroup Test: cleanup1

Hi,
This patch does cleanup in first set of testcases.
It defines a new function to print test results.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@248 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: change subsyscheck logic in testscript
Balbir Singh [Wed, 17 Dec 2008 15:03:49 +0000 (15:03 +0000)] 
libcgroup Test: change subsyscheck logic in testscript

Hi
The shell script as expected does not do a non null check using -n option
as i observed. hence changing the logic as below.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@247 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgrouptest-multimnt-sanitycheck
Balbir Singh [Wed, 17 Dec 2008 15:02:54 +0000 (15:02 +0000)] 
libcgroup Test: libcgrouptest-multimnt-sanitycheck

Hi
The following patch adds the sanity check in c file for multiple mount case.
The parameter passed to the function decides whether the check is for single
mount or multiple mount.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@246 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgrouptest-multimnt05
Balbir Singh [Wed, 17 Dec 2008 15:01:48 +0000 (15:01 +0000)] 
libcgroup Test: libcgrouptest-multimnt05

Hi
The following patch adds three testcases for libcg apis create and delete _cgroup()
and wrapper apis for multiple mount case.
The patch creates a valid cgroup structure with two controllers and after
calling to apis performs a check under both controllers.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@245 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgrouptest-multimnt04
Balbir Singh [Wed, 17 Dec 2008 15:00:37 +0000 (15:00 +0000)] 
libcgroup Test: libcgrouptest-multimnt04

This patch adds a testcase for libcgroup API cgroup_delete_cgroup() testing.
The API is called under the multimount condition(FS_MOUNTED=2) and return
values are checked. The group is checked if it is deleted from the root directory
of the corresponding controller's mountpoint.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@244 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgrouptest-multimnt03
Balbir Singh [Wed, 17 Dec 2008 14:59:35 +0000 (14:59 +0000)] 
libcgroup Test: libcgrouptest-multimnt03

This patch adds a testcase for libcgroup API cgroup_attach_task() testing.
The API is called under the multimount condition(FS_MOUNTED=2) and return
values are checked. The argument of the api is a valid group under one
controller's(say cpu) mountpoint. This group exist only under one
controller(cpu). So the attached task is checked under this group for this(cpu)
controller and under the root group for the other(memory) controller.
In the second call the argument is a group under other controller(memory)
and hence now task is checked under the two groups of both controllers.
In the third calll we give the argument as a non existing group, so the
return value should be ECGROUPNOTEXIST.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@243 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgrouptest-multimnt02
Balbir Singh [Wed, 17 Dec 2008 14:58:42 +0000 (14:58 +0000)] 
libcgroup Test: libcgrouptest-multimnt02

This patch adds a testcase for libcgroup API cgroup_create_cgroup() testing.
The API is called under the multimount condition(FS_MOUNTED=2) and return
values are checked. The group is checked if it exists under the root directory
of the corresponding controller's mountpoint.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@242 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: libcgrouptest-multimnt01
Balbir Singh [Wed, 17 Dec 2008 14:57:54 +0000 (14:57 +0000)] 
libcgroup Test: libcgrouptest-multimnt01

This patch adds a testcase for libcgroup API cgroup_attach_task() testing.
The API is called under the multimount condition(FS_MOUNTED=2) and return
values are checked. The task pid is checked if it exists under the root
group's tasks file of both the mountpoints.

The patch also puts the common code in a function.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@241 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup Test: multi-mount-script-enhanced
Balbir Singh [Wed, 17 Dec 2008 14:56:40 +0000 (14:56 +0000)] 
libcgroup Test: multi-mount-script-enhanced

This patch modifies the script to handle multiple mounts. The earlier
functions are modified and new ones are added. There is still some hard
coding with respect to the number of mountpoints and controllers. I will
update this code part once I get an idea of a better design.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@240 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Give write access to the group as well
Dhaval Giani [Wed, 17 Dec 2008 12:29:12 +0000 (12:29 +0000)] 
libcgroup: Give write access to the group as well

Though we had group details to allow groups access to the cgroup fs, we
had not given the group write access. Correct this bug.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@239 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Add default group to cgconfig
Dhaval Giani [Tue, 16 Dec 2008 17:29:38 +0000 (17:29 +0000)] 
libcgroup: Add default group to cgconfig

From: Balbir Singh <balbir@linux.vnet.ibm.com>

As discussed in the previous thread
http://article.gmane.org/gmane.comp.lib.libcg.devel/139, we don't have
the concept of default groups and tasks should be able to return back
to their default group when done.

Here is a fix to the cgconfig script to fix the issue. Please review,
comment on it.

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@238 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix broken cgred
Dhaval Giani [Tue, 16 Dec 2008 17:20:11 +0000 (17:20 +0000)] 
libcgroup: Fix broken cgred

From: Balbir Singh <balbir@linux.vnet.ibm.com>

cgred is broken, in that there are some checks that fail and we use
--config to start the daemon and that is not supported. We also use
-12 as the signal to killproc.

This patch fixes all of those issues

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@237 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Add default group to cgconfig
Dhaval Giani [Tue, 16 Dec 2008 17:14:33 +0000 (17:14 +0000)] 
libcgroup: Add default group to cgconfig

From: Balbir Singh <balbir@linux.vnet.ibm.com>

As discussed in the previous thread
http://article.gmane.org/gmane.comp.lib.libcg.devel/139, we don't have
the concept of default groups and tasks should be able to return back
to their default group when done.

Here is a fix to the cgconfig script to fix the issue. Please review,
comment on it.

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@236 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Segfault when we run setuid testcase without argument
Dhaval Giani [Sun, 14 Dec 2008 04:35:46 +0000 (04:35 +0000)] 
libcgroup: Segfault when we run setuid testcase without argument

From: "Rishikesh K. Rajak" <risrajak@linux.vnet.ibm.com>

In libcgroup testcase "setuid" testcase segfault when we run without uid
parameter.
This patch fixes the issue.

[dhaval@linux.vnet.ibm.com: Minor fixes]
Signed-off-by: Rishikesh k Rajak <risrajak@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@235 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Better error reporting for libcgroup
Dhaval Giani [Tue, 9 Dec 2008 11:18:39 +0000 (11:18 +0000)] 
libcgroup: Better error reporting for libcgroup

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

16 years agolibcgroup: Improve parameter checking and usage in cgconfigparser
Dhaval Giani [Tue, 9 Dec 2008 11:14:24 +0000 (11:14 +0000)] 
libcgroup: Improve parameter checking and usage in cgconfigparser

From: Sripathi Kodi <sripathik@in.ibm.com>

The following patch improves cgconfigparser's parameter checking and
usage(). It provides:

1) Support for long options. Not really needed now, but good to have.
2) Improved usage() functionality.

Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@227 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agoFrom: SanjayKumar J <vjsanjay@gmail.com>
Balbir Singh [Mon, 1 Dec 2008 09:50:00 +0000 (09:50 +0000)] 
From: SanjayKumar J <vjsanjay@gmail.com>

Consistent Error checking  for group_admin_perm

Signed-off-by: SanjayKumar J <vjsanjay@gmail.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
[Balbir - change prefix in Makefile to /usr, so that make install does sensible
things]

git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@226 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Auto generated documentation
Dhaval Giani [Wed, 26 Nov 2008 06:52:11 +0000 (06:52 +0000)] 
libcgroup: Auto generated documentation

This patch provides a doxyfile and allows doxygen to generate useful
documentation from code. Please review!

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Dhaval Giani <dhaval@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@225 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Compile pam_cgroup.so by default
Dhaval Giani [Wed, 26 Nov 2008 06:48:20 +0000 (06:48 +0000)] 
libcgroup: Compile pam_cgroup.so by default

The PAM module was not getting compiled while doing a make. Correct that.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@224 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Bug fix in libcgroup wrapper api
Dhaval Giani [Tue, 18 Nov 2008 16:46:16 +0000 (16:46 +0000)] 
libcgroup: Bug fix in libcgroup wrapper api

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

16 years agolibcgroup: Make cgconfigparser more verbose
Dhaval Giani [Mon, 10 Nov 2008 13:10:07 +0000 (13:10 +0000)] 
libcgroup: Make cgconfigparser more verbose

As per http://sourceforge.net/tracker/?func=detail&atid=1043649&aid=2128139&group_id=218421
cgconfigparser was not exiting silently for wrong usage.  Let's
let the user know they are using wrong syntax.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Tested-by: Sudhir Kumar <sudhir@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@221 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Minor release v0.32.1
Dhaval Giani [Thu, 23 Oct 2008 08:01:00 +0000 (08:01 +0000)] 
libcgroup: Minor release v0.32.1

Some minor fixes to the Makefile and other fixes by Balbir.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@218 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agoMerge several bug-fixes and cleanups. No version bump yet, since this is
Balbir Singh [Wed, 15 Oct 2008 04:20:29 +0000 (04:20 +0000)] 
Merge several bug-fixes and cleanups. No version bump yet, since this is
an ongoing exercise (after more testing, I'll recommend one).

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@216 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix makefile entry for cgconfigparser
Dhaval Giani [Fri, 10 Oct 2008 20:50:12 +0000 (20:50 +0000)] 
libcgroup: Fix makefile entry for cgconfigparser

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@213 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: v0.32
Dhaval Giani [Tue, 30 Sep 2008 16:04:44 +0000 (16:04 +0000)] 
libcgroup: v0.32

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@204 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: ABI guarantee
Dhaval Giani [Tue, 30 Sep 2008 15:59:18 +0000 (15:59 +0000)] 
libcgroup: ABI guarantee
From: Balbir Singh <balbir@linux.vnet.ibm.com>

Versioning all the symbols, in order to provide ABI guarantee.

Bringing Balbir's patch up to date, and changing the version to 0.32.

Please review.

[dhaval@linux.vnet.ibm.com: updated with latest symbols]
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@203 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Change how cgroup_get_cgroup works
Dhaval Giani [Mon, 29 Sep 2008 14:14:51 +0000 (14:14 +0000)] 
libcgroup: Change how cgroup_get_cgroup works

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

16 years agoConfiguration rewrite to use the main cgroups API and several bug fixes
Balbir Singh [Mon, 29 Sep 2008 12:26:50 +0000 (12:26 +0000)] 
Configuration rewrite to use the main cgroups API and several bug fixes
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

16 years agoThe automatic classification engine (cgexec, cgclassify, pam_cgroup)
Balbir Singh [Mon, 29 Sep 2008 12:09:04 +0000 (12:09 +0000)] 
The automatic classification engine (cgexec, cgclassify, pam_cgroup)
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

16 years agoMerge the cgruleseng daemon from Steve Olivieri
Balbir Singh [Fri, 26 Sep 2008 11:56:34 +0000 (11:56 +0000)] 
Merge the cgruleseng daemon from Steve Olivieri

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

16 years agoOnce we build the path, we don't have all the room in path anymore.
Balbir Singh [Sat, 20 Sep 2008 00:56:09 +0000 (00:56 +0000)] 
Once we build the path, we don't have all the room in path anymore.
Instead of using sizeof(path), we should use FILENAME_MAX -
strlen(path) - 1.

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@186 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agoFix a warning in api.c, where we ignore the fscanf value.
Balbir Singh [Sat, 20 Sep 2008 00:54:04 +0000 (00:54 +0000)] 
Fix a warning in api.c, where we ignore the fscanf value.
I've tested the patch by running the tests available in the tests
directory.

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@185 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Check for NULL data structures in the wrappers
Dhaval Giani [Fri, 5 Sep 2008 18:53:13 +0000 (18:53 +0000)] 
libcgroup: Check for NULL data structures in the wrappers

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

16 years agolibcgroup: Change variables to *printf/*scanf to use inttypes.h
Dhaval Giani [Fri, 5 Sep 2008 18:47:57 +0000 (18:47 +0000)] 
libcgroup: Change variables to *printf/*scanf to use inttypes.h

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

16 years agolibcgroup: Fix makefile entry for cgclassify
Dhaval Giani [Fri, 5 Sep 2008 15:38:53 +0000 (15:38 +0000)] 
libcgroup: Fix makefile entry for cgclassify

cgclassify depends on libcgroup.so. Ensure that the dependency is
met.

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@175 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix makefile entry for make clean
Dhaval Giani [Wed, 27 Aug 2008 10:39:08 +0000 (10:39 +0000)] 
libcgroup: Fix makefile entry for make clean

Don't know when this change happened, or got missed. Correcting it
now.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@171 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: bump up version to 0.31
Dhaval Giani [Tue, 26 Aug 2008 13:43:13 +0000 (13:43 +0000)] 
libcgroup: bump up version to 0.31

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@169 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agoMore fixes to the earlier attempt to create new cgroup inheriting parent's
Balbir Singh [Fri, 22 Aug 2008 22:34:50 +0000 (22:34 +0000)] 
More fixes to the earlier attempt to create new cgroup inheriting parent's
attributes. Test cases have also been updated.

Tested on an x86_64 box with libcg_ba

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@166 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agoThis patch adds cgroup_create_cgroup_from_parent() API. I've tested it
Balbir Singh [Fri, 22 Aug 2008 16:44:17 +0000 (16:44 +0000)] 
This patch adds cgroup_create_cgroup_from_parent() API. I've tested it
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

16 years agolibcgroup: A simple pam module (pam_cgroup.so) for task placement in right cgroup
Dhaval Giani [Fri, 15 Aug 2008 19:52:13 +0000 (19:52 +0000)] 
libcgroup: A simple pam module (pam_cgroup.so) for task placement in right cgroup

From: Vivek Goyal <vgoyal@redhat.com>

o A simple pam module pam_cgroup for placement of tasks in right cgroup.
  Details are available in documentation.

o This pam module will be included in libcgroup source and not in
  pam sources.

o Copyright notice looks little odd as I copied the original copyright
  notice of pam_limits.c. Any suggestions for improvement are welcome.

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@162 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup testcases: fix small testcase issue
Dhaval Giani [Fri, 15 Aug 2008 05:14:12 +0000 (05:14 +0000)] 
libcgroup testcases: fix small testcase issue

From: Sudhir Kumar <skumar@linux.vnet.ibm.com>

This patch fixes a small mistake in the testcase where we were comparing
string values like integers.

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@161 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Some cgexec cleanups
Dhaval Giani [Fri, 15 Aug 2008 05:10:28 +0000 (05:10 +0000)] 
libcgroup: Some cgexec cleanups

From: Vivek Goyal <vgoyal@redhat.com>

cgexec cleanup based on balbir's feedback.

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@160 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Some libcgroup API cleanups
Dhaval Giani [Fri, 15 Aug 2008 05:06:14 +0000 (05:06 +0000)] 
libcgroup: Some libcgroup API cleanups

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

16 years agolibcgroup: Add up missing scripts/samples
Dhaval Giani [Fri, 15 Aug 2008 05:02:35 +0000 (05:02 +0000)] 
libcgroup: Add up missing scripts/samples

From: Balbir Singh <balbir@linux.vnet.ibm.com>

Dhaval missed a few files while adding files to the
reporsitory. Adding them in now.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@158 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Move trunk to v0.3
Dhaval Giani [Thu, 14 Aug 2008 18:57:46 +0000 (18:57 +0000)] 
libcgroup: Move trunk to v0.3

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@156 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix up Makefile.in so that we don't lose tests
Dhaval Giani [Thu, 14 Aug 2008 18:22:33 +0000 (18:22 +0000)] 
libcgroup: Fix up Makefile.in so that we don't lose tests

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@155 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix cgroup_fill_cgc()
Dhaval Giani [Thu, 14 Aug 2008 18:20:07 +0000 (18:20 +0000)] 
libcgroup: Fix cgroup_fill_cgc()

We were failing on stat's success. Stupid thing to do really. Fixing
that now.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@154 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix return values in cgroup_attach_value
Dhaval Giani [Thu, 14 Aug 2008 18:13:22 +0000 (18:13 +0000)] 
libcgroup: Fix return values in cgroup_attach_value

cgroup_attach_task_pid() should return ECGROUPNOTEXIST when we get an
ENOENT from glibc. This patch makes that correction

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@153 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agoFix configuration assert when multiple controllers are enabled
Dhaval Giani [Thu, 14 Aug 2008 15:05:48 +0000 (15:05 +0000)] 
Fix configuration assert when multiple controllers are enabled

Since we support multiple controllers, asserting is no longer a good
idea.

TODO: Support other controllers, memory, cpu and cpuacct (possibly
cpusets as well). Well, this code is obsolete and will be replaced
by the newer cgroup API.

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@152 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: beautify strcpy in modify_cgroup
Dhaval Giani [Thu, 14 Aug 2008 14:51:47 +0000 (14:51 +0000)] 
libcgroup: beautify strcpy in modify_cgroup

The code looked ugly. De-uglyfy it.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@151 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix up some free errors
Dhaval Giani [Thu, 14 Aug 2008 14:29:29 +0000 (14:29 +0000)] 
libcgroup: Fix up some free errors

Sudhir reported a free() issue, it got traced to this issue.

https://sourceforge.net/tracker/index.php?func=detail&aid=2049822&group_id=218421&atid=1043649

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Sudhir Kumar <skumar@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@150 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Add a mktarball-trunk script
Dhaval Giani [Thu, 14 Aug 2008 11:31:38 +0000 (11:31 +0000)] 
libcgroup: Add a mktarball-trunk script

This script allows a tarball of the current trunk to be
generated.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@147 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix cgroup_modify_cgroup
Dhaval Giani [Thu, 14 Aug 2008 11:16:57 +0000 (11:16 +0000)] 
libcgroup: Fix cgroup_modify_cgroup

An almost unused and less tested API. The path was getting
misformed. This was because it had not been set in the first place.

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@146 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix the delete API
Dhaval Giani [Thu, 14 Aug 2008 11:10:23 +0000 (11:10 +0000)] 
libcgroup: Fix the delete API

The delete call was returning a wrong value even on success.
The reason was because in the fallback path, we try to delete
all the groups again. Now it is possible that a group might
have already been deleted and we return a wrong value.

Change the API to check if the group exists before trying to rmdir
it in the error path.

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@145 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Ensure null is returned if cgroup does not exist in cgroup_get_cgroup()
Dhaval Giani [Thu, 14 Aug 2008 05:03:36 +0000 (05:03 +0000)] 
libcgroup: Ensure null is returned if cgroup does not exist in cgroup_get_cgroup()

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@143 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: zero out allocated memory
Dhaval Giani [Thu, 14 Aug 2008 05:01:33 +0000 (05:01 +0000)] 
libcgroup: zero out allocated memory

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

16 years agolibcgroup: Sample configuration files
Dhaval Giani [Thu, 14 Aug 2008 04:50:05 +0000 (04:50 +0000)] 
libcgroup: Sample configuration files

From: Balbir Singh <balbir@linux.vnet.ibm.com>

Dhaval forgot to add these files while merging the code.
Merging them in now.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@140 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Change compiler to GCC
Dhaval Giani [Thu, 14 Aug 2008 04:44:12 +0000 (04:44 +0000)] 
libcgroup: Change compiler to GCC

For some reason these changes got lost. Making the change again.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@139 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agocgclassify: A command line tool to classify/re-classify already running task
Dhaval Giani [Wed, 13 Aug 2008 20:04:51 +0000 (20:04 +0000)] 
cgclassify: A command line tool to classify/re-classify already running task

From: Vivek Goyal <vgoyal@redhat.com>

o cgclassify, a command line tool to put a list of pids to the right cgroup
  based on rules in /etc/cgrules.conf. It can be mainly used for
  reclassification of tasks which are already running. Can think of two
  use cases.
        - During initial bootup, after cgroups are mounted, one needs to
          move tasks (started beofore cgroups were mounted) into right
          cgroup.

        - Once can choose to reclassify the tasks if admin has changed the
          rules and thinks a group of tasks should reclassified based on
          new rules.

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@138 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agocgexec: A command line tool to execute a task in a cgroup
Dhaval Giani [Wed, 13 Aug 2008 20:01:16 +0000 (20:01 +0000)] 
cgexec: A command line tool to execute a task in a cgroup

From: Vivek Goyal <vgoyal@redhat.com>

o cgexec, a command line tool for placing the task in right cgroup
  in advance so that no help is needed from rules daemon and user can
  avoid delay in execution of rules.

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@137 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: New API interfaces for task placement
Dhaval Giani [Wed, 13 Aug 2008 19:58:05 +0000 (19:58 +0000)] 
libcgroup: New API interfaces for task placement

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