]> git.ipfire.org Git - thirdparty/libcgroup.git/log
thirdparty/libcgroup.git
16 years agolibcgroup: Install the man pages
Dhaval Giani [Thu, 26 Feb 2009 10:16:24 +0000 (10:16 +0000)] 
libcgroup: Install the man pages

From: Ivana Varekova <varekova@redhat.com>

The man pages should be installed so the patch for Makefile
(with the last - for now not incorporated man page)

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

16 years agolibcgroup: Move the man page into the correct location
Dhaval Giani [Thu, 26 Feb 2009 10:13:01 +0000 (10:13 +0000)] 
libcgroup: Move the man page into the correct location

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

16 years agolibcgroup: cgred.conf.5 man page
Dhaval Giani [Thu, 26 Feb 2009 10:07:13 +0000 (10:07 +0000)] 
libcgroup: cgred.conf.5 man page

From: Ivana Varekova <varekova@redhat.com>

This is my proposal of cgred.conf man page. There are used  some of some parts
of present documentation of libcg - again.

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

16 years agolibcgroup: Rename dbg() to cgroup_dbg()
Dhaval Giani [Wed, 25 Feb 2009 13:43:27 +0000 (13:43 +0000)] 
libcgroup: Rename dbg() to cgroup_dbg()

From: Jan Safranek <jsafrane@redhat.com>

Rename dbg() to cgroup_dbg() everywhere.

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

16 years agolibcgroup: Remove PACKAGE_VERSION from Makefile.in
Dhaval Giani [Wed, 25 Feb 2009 13:34:30 +0000 (13:34 +0000)] 
libcgroup: Remove PACKAGE_VERSION from Makefile.in

From: Jan Safranek <jsafrane@redhat.com>

PACKAGE_VERSION is defined both in config.h and Makefile.in, which results
in 'PACKAGE_VERSION redefined' warnings. It should be defined only once,
let's say in config.h.

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

16 years agolibcgroup: Include config.h
Dhaval Giani [Wed, 25 Feb 2009 13:32:48 +0000 (13:32 +0000)] 
libcgroup: Include config.h

From: Jan Safranek <jsafrane@redhat.com>

config.h (and therefore definition of CGROUP_DEBUG) should be included
where appropriate.

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

16 years agolibcgroup: Move dbg() to libcgroup-internal.h
Dhaval Giani [Wed, 25 Feb 2009 13:31:29 +0000 (13:31 +0000)] 
libcgroup: Move dbg() to libcgroup-internal.h

From: Jan Safranek <jsafrane@redhat.com>

I think dbg() should be in internal header file and not in the public one.
The tools get their own definition of dbg() so they don't need to include
library private header.

dbg() is defined on three places now, it will make more sense when the sources
are distributed to different directories.

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

16 years agocgclassify: Update cgclassify man page
Dhaval Giani [Wed, 25 Feb 2009 13:07:02 +0000 (13:07 +0000)] 
cgclassify: Update cgclassify man page

From: Jan Safranek <jsafrane@redhat.com>

Update cgclassify man page to reflect new '-g' parameter.

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

16 years agocgclassify: Add -g option to cgclassify
Dhaval Giani [Wed, 25 Feb 2009 13:05:56 +0000 (13:05 +0000)] 
cgclassify: Add -g option to cgclassify

From: Jan Safranek <jsafrane@redhat.com>

cgclassify tools currently moves processes to groups only as specified in
cgrules.conf. It would be nice to move processes to another group,
specified on command line, like cgexec does.

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

16 years agolibcgroup: Move parse_cgroup_data to separate .c file
Dhaval Giani [Wed, 25 Feb 2009 13:04:34 +0000 (13:04 +0000)] 
libcgroup: Move parse_cgroup_data to separate .c file

From: Jan Safranek <jsafrane@redhat.com>

Cgclassify could benefit from parsing of -g command line option, let's move it
to separate file, where both cgexec and cgclassify can use it.

The data structures and function names are also more descriptive now.

I added also the copyright notice and license to the new files.

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

16 years agoFrom: Ivana Varekova <varekova@redhat.com>
Balbir Singh [Mon, 23 Feb 2009 14:41:10 +0000 (14:41 +0000)] 
From: Ivana Varekova <varekova@redhat.com>

This patch fixes spec file handling of daemon parts of libcg
(add chkconfig to post and including dependency, fix preun script).
And fix the levels in which is this daemon start by default (should not be any).

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

16 years agoFrom: Ivana Varekova <varekova@redhat.com>
Balbir Singh [Mon, 23 Feb 2009 14:10:58 +0000 (14:10 +0000)] 
From: Ivana Varekova <varekova@redhat.com>

This patch changes cgconfig.conf - comment all rows and rename
example values - to have example which should be installed to /etc/.
Move cgred to /etc/sysconfig and patch spec to install all
/etc/* configuration files (at least they shows examples and
help to user to do their own configuration).).

Signed-off-by: Ivana Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
NOTE: The spec file is still broken due to lack of packaging of pam_cgroup.so.

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

16 years agoImpact: Fix the parsing issue when two or more values are specified
Balbir Singh [Sat, 21 Feb 2009 15:34:24 +0000 (15:34 +0000)] 
Impact: Fix the parsing issue when two or more values are specified

This patch fixes an issue where when two or more values are specified for
the controllers, only the last one is applied. This patch fixes that issue.
The parser is modified to collate all the name value pairs, seperated by
":". The reason for implementing it this way is because we need to pass
the controller name and splitting the rules would make it very hard to pass
the controller name to each rule, irrespective of where the controller name
was parsed.

Tested with the following config file

group default {
perm {
task {
uid = root;
gid = root;
}
admin {
uid = root;
gid = root;
}
}

cpu {
cpu.shares = 2048;
}

cpuset {
cpuset.mems=0;
cpuset.cpus=0-1;
}
}

mount {
cpu = /cgroup/cpu;
cpuacct = /cgroup/cpu;
cpuset = /cgroup/cpu;
}

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

16 years agolibcgorup: Fix a chown security issue
Dhaval Giani [Sat, 21 Feb 2009 07:28:19 +0000 (07:28 +0000)] 
libcgorup: Fix a chown security issue

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

Impact: Bug fix causes incorrect chown

This patch fixes a potential security issue, we free path and add
reallocate it using asprintf, but that breaks chown, since that relies on
fts_path[0] and path to point to the same address location.

Please review, comment.

[dhaval@linux.vnet.ibm.com: Fixed the return checks]
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@335 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix return values
Dhaval Giani [Sat, 21 Feb 2009 07:22:19 +0000 (07:22 +0000)] 
libcgroup: Fix return values

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

Impact: Bug fix, fix incorrect return values

This patch fixes incorrect return value of -1 being returned from
some call sites. Please review, comment. printf's are ugly, so they've
been converted to dbg.

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

16 years agoThis is my proposal of cgconfigparser man page. I've used some of some parts
Balbir Singh [Tue, 17 Feb 2009 11:18:48 +0000 (11:18 +0000)] 
This is my proposal of cgconfigparser man page. I've used some of some parts
of present documentation of libcg - again.

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

16 years agoThis is my proposal of cgclassify man page. I've used some of some parts
Balbir Singh [Tue, 17 Feb 2009 11:17:08 +0000 (11:17 +0000)] 
This is my proposal of cgclassify man page. I've used some of some parts
of present documentation of libcg - again.

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

16 years agoThis is my proposal of cgexec man page. I've used some of some parts
Balbir Singh [Tue, 17 Feb 2009 09:25:59 +0000 (09:25 +0000)] 
This is my proposal of cgexec man page. I've used some of some parts
of present documentation of libcg - again.

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

16 years agoFeature: Add new man page for cgrules.conf
Balbir Singh [Tue, 17 Feb 2009 09:16:28 +0000 (09:16 +0000)] 
Feature: Add new man page for cgrules.conf

This is my proposal of cgrules.conf man page. There are all necessary parts
(for some of them I use parts of present documentation of libcg).

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

16 years agoThis patch store the last errno value to last_errno value and add
Balbir Singh [Mon, 16 Feb 2009 13:34:12 +0000 (13:34 +0000)] 
This patch store the last errno value to last_errno value and add
cgroup_add_last_errno procedure to show this number.

Use this procedure to show the cause of the error when ECGOTHER is returned.

[balbir@linux.vnet.ibm.com: fix last_errno in config.c]
Signed-off-by: Ivana Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@329 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Install the PAM module
Dhaval Giani [Mon, 16 Feb 2009 08:49:28 +0000 (08:49 +0000)] 
libcgroup: Install the PAM module

From: Jan Safranek <jsafrane@redhat.com>

Install the PAM module to suitable directory. I didn't find any AC macro for
location of the PAM module, I hope static path is OK.

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

16 years agolibcgroup: Add man pages to Makefile
Dhaval Giani [Mon, 16 Feb 2009 08:47:27 +0000 (08:47 +0000)] 
libcgroup: Add man pages to Makefile

From: Jan Safranek <jsafrane@redhat.com>

The man page is in Makefile.in now, make install should install it
to appropriate place.

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

16 years agolibcgroup: Add configure option to enable debug output
Dhaval Giani [Mon, 16 Feb 2009 08:45:54 +0000 (08:45 +0000)] 
libcgroup: Add configure option to enable debug output

From: Jan Safranek <jsafrane@redhat.com>

There is new configure script option, which defines CGROUP_DEBUG.
Usage: ./configure --enable-debug

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

16 years agolibcgroup: Rename DEBUG to CGROUP_DEBUG
Dhaval Giani [Mon, 16 Feb 2009 08:43:31 +0000 (08:43 +0000)] 
libcgroup: Rename DEBUG to CGROUP_DEBUG

From: Jan Safranek <jsafrane@redhat.com>

Using plain DEBUG can be dangerous, it might have side effects on different
libraries, there should be something with CGROUP_ prefix.

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

16 years agolibcgroup: Compile cgrulesengd without -DDEBUG
Dhaval Giani [Mon, 16 Feb 2009 08:41:19 +0000 (08:41 +0000)] 
libcgroup: Compile cgrulesengd without -DDEBUG

From: Jan Safranek <jsafrane@redhat.com>

Cgrulesengd writes some debugging info to stdout by default. IMHO
this feature should be enabled only when user explicitly asks so
during compilation, like the other tools.

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

16 years agolibcgroup: Don't store Makefile in SVN
Dhaval Giani [Thu, 12 Feb 2009 16:43:06 +0000 (16:43 +0000)] 
libcgroup: Don't store Makefile in SVN

From: Jan Safranek <jsafrane@redhat.com>

Makefile is generated by configure script, it should not be stored in SVN.
I hope SVN understands such patches :).

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@323 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Add new command line options to sample config file
Dhaval Giani [Thu, 12 Feb 2009 16:05:00 +0000 (16:05 +0000)] 
libcgroup: Add new command line options to sample config file

From: Jan Safranek <jsafrane@redhat.com>

Add new command line options to sample config file

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

16 years agolibcgroup: Add command line options to set log level and log destinations.
Dhaval Giani [Thu, 12 Feb 2009 16:03:39 +0000 (16:03 +0000)] 
libcgroup: Add command line options to set log level and log destinations.

From: Jan Safranek <jsafrane@redhat.com>

I rewrote the parsing to getopt - it's IMHO less error-prone and
new options can be added quite easily. Each new option has short
and long variant, both shown in --help.

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

16 years agolibcgroup: Make the group change logs more readable
Dhaval Giani [Thu, 12 Feb 2009 16:02:22 +0000 (16:02 +0000)] 
libcgroup: Make the group change logs more readable

From: Jan Safranek <jsafrane@redhat.com>

Function cgre_process_event() logs success/failure of group change two
times, each with different log severity. It should be logged just once.

[dhaval@linux.vnet.ibm.com: Minor changes to the changelog]
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@320 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Send log message to a log file, to syslog or to both.
Dhaval Giani [Thu, 12 Feb 2009 16:01:07 +0000 (16:01 +0000)] 
libcgroup: Send log message to a log file, to syslog or to both.

From: Jan Safranek <jsafrane@redhat.com>

Rework whole cgrulesengd logging to be able to send log messages to syslog.
Also introduce more log levels:

LOG_NOTICE is the default log level, it logs startup/shutdown/configuration
reload and errors.

LOG_INFO shows in addition content of configuration file (only
if logging to file is enabled) and changing cgroup of a PID.

LOG_DEBUG show all details as it was before the patch.

TODO: if something gets wrong with mounted hierarchies (e.g. root unmounts
them), the log gets full of "Cgroup change for PID: ... FAILED". Some
suppression should be implemented.

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

16 years agolibcgroup: Convert any printf to dbg
Dhaval Giani [Tue, 10 Feb 2009 18:00:58 +0000 (18:00 +0000)] 
libcgroup: Convert any printf to dbg

From: Jan Safranek <jsafrane@redhat.com>

There are some messages printed directly to stdout, let's convert them to
dbg().

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

16 years agoI've noticed it's possible to set permissions and other parameters of root
Balbir Singh [Fri, 6 Feb 2009 16:02:24 +0000 (16:02 +0000)] 
I've noticed it's possible to set permissions and other parameters of root
control group, i.e. the group which is implicitly created on mount and contains
all processes.

Admin can use '.' as the group name and he/she can set group's parameters as
usual. I am not sure it's a bug or feature, I've just documented current
behavior on appropriate man page.

[Balbir, simple spell fixes]

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

16 years agoThe previous patch is split so the second part of the patch:
Balbir Singh [Tue, 3 Feb 2009 10:26:01 +0000 (10:26 +0000)] 
The previous patch is split so the second part of the patch:

This part change error messages - to dbg info messages - the data from error messages are now printed in main procedure

Signed-off-by: Ivana Varekova <varekova@redhat.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@316 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agoHere is my proposal for a man page describing content of /etc/cgconfig.conf.
Balbir Singh [Tue, 3 Feb 2009 09:43:57 +0000 (09:43 +0000)] 
Here is my proposal for a man page describing content of /etc/cgconfig.conf.
I did not find any realistic example of configuration file, I just thought
of something mounting groups to /mnt/cgroups. Is it suitable location of
such mount points? Or is /container mentioned on libcg web the right place
for such mounts?

Feel free to rephrase and reformat anything, especially RECOMMENDATIONS
section would appreciate some 'official' content - I wrote there just my
experiences. I'm not native speaker, please look for grammar errors too.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Reviewed-by: Ivana Varekova <varekova@redhat.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@315 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgrouptest: rename get_controller() to is_subsystem_enabled()
Dhaval Giani [Wed, 14 Jan 2009 17:33:05 +0000 (17:33 +0000)] 
libcgrouptest: rename get_controller() to is_subsystem_enabled()

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

This patch renames the function get_controllers() to a more
meaningful name is_subsystem_enabled().

history:
The code in the patch is part of a patch sent in an earlier patchset,
which somehow got dropped (looks an older version of that patch was
merged to the tree). Adding this patch makes everything upstream upto
the discussion held on the list.

Signed-off-by: Sudhir Kumar <skumar@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@314 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgrouptest: open may fail wrt permissions, so use stat
Dhaval Giani [Fri, 9 Jan 2009 16:30:28 +0000 (16:30 +0000)] 
libcgrouptest: open may fail wrt permissions, so use stat

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

The patch was adding a warning
"test_functions.c:359: warning: unused variable â€˜ret’"
Hence resending correcting it.

open may fail in case there is not proper permissions and hence giving
a wrong result. This patch uses stat instead which is always better.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-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@312 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgrouptest: let check_task() receive a pid as argument
Dhaval Giani [Fri, 9 Jan 2009 16:27:48 +0000 (16:27 +0000)] 
libcgrouptest: let check_task() receive a pid as argument

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

The patch would get a reject because of modifications in an earlier
patch. Hence updating the patch by fixing the reject.

This patch makes the function check_task() capable of checking if a pid
other than the calling process is attached to a particlular group. Earlier
it was checking for the calling process only.
For optimization purpose 0 is used to indicate that the task to be attached
is the current task and hence call cgroup_gettid() only once.

Signed-off-by: Sudhir Kumar <skumar@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@311 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgrouptest:attach exclusive pid support in test_cgroup_attach_task() function
Dhaval Giani [Fri, 9 Jan 2009 16:26:15 +0000 (16:26 +0000)] 
libcgrouptest:attach exclusive pid support in test_cgroup_attach_task() function

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

The function test_attach_task_pid() was attaching the process calling the
function to a group and did not have support to take any pid for attaching
it to a group. This patch does that.

Signed-off-by: Sudhir Kumar <skumar@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@310 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgrouptest: Move functions into a new file to reuse
Dhaval Giani [Fri, 9 Jan 2009 16:23:01 +0000 (16:23 +0000)] 
libcgrouptest: Move functions into a new file to reuse

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

There were some coding style warnings that have been fixed in this
patch. Basicaly the ones reported by checkpatch.pl

This patch puts the test functions in a separate file so that they
can be reused for further testing. Some of the functions were static
and hence changed to be non static. It also edits the Makefile so
that the patch compiles.

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

16 years agolibcgrouptest: Avoid external variables usage
Dhaval Giani [Fri, 9 Jan 2009 10:19:02 +0000 (10:19 +0000)] 
libcgrouptest: Avoid external variables usage

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

A lack of proper initial thought let me use some variables globaly, which
is not a good idea at all. However fixing this issue at this stage is not
very good from the point that it changes variables for a lot of functions.
But still it has to be done for a better and reusable code. This patch does
that while putting related variables in meaningful structs.
Thanks to Balbir for a good suggestion.

TODO:
Fill these data structures from a configuration file after analyzing
requirements from different test functions.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
Acked-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@307 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Fix low hanging cleanups
Dhaval Giani [Tue, 6 Jan 2009 08:47:57 +0000 (08:47 +0000)] 
libcgroup: Fix low hanging cleanups

Some of the cleanups possible are obvious.
1. Change usage of strcat to strncat
2. Change usage of tge following type
        char *s = malloc();
        strcpy(s, "somestring");
        strcat(s, "someotherstring");

to something more easily understandble such as
        asprintf(&s, "%s%s", somestring, someotherstring);
Changes for v2:
1. Fix some memory leaks discovered using valgrind
2. Fix Balbir's comments regarding codingstyle.
3. Move the controllers array memory leak fix into another patch
Changes from v1:
1. Correct the error handling of asprintf as pointed out by Dan Smith

TODO:
1. Figure out what is the correct value of n for cg_build_path_locked

valgrind output,

[root@gondor tests]# sh runlibcgrouptest.sh

Running first set of testcases
==============================
==5067== Memcheck, a memory error detector.
==5067== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==5067== Using LibVEX rev 1804, a library for dynamic binary translation.
==5067== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==5067== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==5067== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==5067== For more details, rerun with: -v
==5067==
C:DBG: fs_mounted as recieved from script=0
TEST 1:PASS : cgroup_init()                      Ret Value = 50001
TEST 2:PASS : cgroup_attach_task()               Ret Value = 50014       Parameter nullcgroup
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 50014
TEST 5:PASS : cgroup_delete_cgroup()             Ret Value = 50014
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 50014
TEST 7:PASS : cgroup_delete_cgroup()             Ret Value = 50014
TEST 8:PASS : cgroup_add_controller()            Ret Value = 0
TEST 9:PASS : cgroup_add_controller()            Ret Value = 0
TEST10:PASS : cgroup_add_controller()            Ret Value = 0
==5067==
==5067== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 1)
==5067== malloc/free: in use at exit: 0 bytes in 0 blocks.
==5067== malloc/free: 18 allocs, 18 frees, 32,293 bytes allocated.
==5067== For counts of detected errors, rerun with: -v
==5067== All heap blocks were freed -- no leaks are possible.

Running second set of testcases
==============================
==5083== Memcheck, a memory error detector.
==5083== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==5083== Using LibVEX rev 1804, a library for dynamic binary translation.
==5083== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==5083== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==5083== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==5083== For more details, rerun with: -v
==5083==
C:DBG: fs_mounted as recieved from script=1
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1
sanity check pass. cgroup
TEST 1:PASS : cgroup_attach_task()               Ret Value = 50014       Parameter nullcgroup
TEST 2:PASS : cgroup_init()                      Ret Value = 0
TEST 3:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 4:PASS : cgroup_attach_task_pid()           Ret Value = 50016
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 7:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
==5083== Conditional jump or move depends on uninitialised value(s)
==5083==    at 0x40070D8: strncat (mc_replace_strmem.c:214)
==5083==    by 0x804BC92: main (libcgrouptest01.c:1271)
==5083==    at 0x40070D8: strncat (mc_replace_strmem.c:214)
==5083==    by 0x804BC92: main (libcgrouptest01.c:1271)
==5083==
==5083== Conditional jump or move depends on uninitialised value(s)
==5083==    at 0x8049471: _ZL14group_modifiedPci (libcgrouptest01.c:1076)
==5083==    by 0x804C583: main (libcgrouptest01.c:254)
==5083==
==5083== Conditional jump or move depends on uninitialised value(s)
==5083==    at 0x8049479: _ZL14group_modifiedPci (libcgrouptest01.c:1076)
==5083==    by 0x804C583: main (libcgrouptest01.c:254)
==5083==
==5083== Conditional jump or move depends on uninitialised value(s)
==5083==    at 0x4007470: strncmp (mc_replace_strmem.c:314)
==5083==    by 0x804949B: _ZL14group_modifiedPci (libcgrouptest01.c:1076)
==5083==    by 0x804C583: main (libcgrouptest01.c:254)
==5083==
==5083== Conditional jump or move depends on uninitialised value(s)
==5083==    at 0x4007475: strncmp (mc_replace_strmem.c:314)
==5083==    by 0x804949B: _ZL14group_modifiedPci (libcgrouptest01.c:1076)
==5083==    by 0x804C583: main (libcgrouptest01.c:254)
==5083==
==5083== Conditional jump or move depends on uninitialised value(s)
==5083==    at 0x4007497: strncmp (mc_replace_strmem.c:314)
==5083==    by 0x804949B: _ZL14group_modifiedPci (libcgrouptest01.c:1076)
==5083==    by 0x804C583: main (libcgrouptest01.c:254)
==5083==
==5083== Conditional jump or move depends on uninitialised value(s)
==5083==    at 0x40074A0: strncmp (mc_replace_strmem.c:314)
==5083==    by 0x804949B: _ZL14group_modifiedPci (libcgrouptest01.c:1076)
==5083==    by 0x804C583: main (libcgrouptest01.c:254)
TEST 8:FAIL : cgroup_modify_cgroup()             Ret Value = 0   Parameter same cgroup
TEST 9:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST10:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST11:PASS : cgroup_modify_cgroup()             Ret Value = 50007
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST14:PASS : cgroup_get_cgroup()                Ret Value = 50007       Parameter nullcgroup
TEST15:PASS : cgroup_get_cgroup()                Ret Value = 50002       Parameter not created group
TEST16:PASS : cgroup_get_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST17:FAIL : cgroup_get_cgroup()                Ret Value = 50017
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST17:PASS : cgroup_create_cgroup()             Ret Value = 50007
TEST18:PASS : cgroup_delete_cgroup()             Ret Value = 50007
TEST19:PASS : cgroup_compare_cgroup()            Ret Value = 50011       Parameter nullcgroup
TEST20:PASS : cgroup_compare_cgroup()            Ret Value = 0
TEST21:PASS : cgroup_compare_cgroup()            Ret Value = 50017
==5083==
==5083== ERROR SUMMARY: 9 errors from 7 contexts (suppressed: 18 from 1)
==5083== malloc/free: in use at exit: 0 bytes in 0 blocks.
==5083== malloc/free: 279 allocs, 279 frees, 237,968 bytes allocated.
==5083== For counts of detected errors, rerun with: -v
==5083== All heap blocks were freed -- no leaks are possible.
Cleanup done

Running third set of testcases
==============================
==5134== Memcheck, a memory error detector.
==5134== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==5134== Using LibVEX rev 1804, a library for dynamic binary translation.
==5134== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==5134== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==5134== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==5134== For more details, rerun with: -v
==5134==
C:DBG: fs_mounted as recieved from script=2
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1
C:DBG: mountpoint2 as recieved from script=/dev/cgroup_controllers-2
sanity check pass. cgroup
TEST 1:PASS : cgroup_init()                      Ret Value = 0
TEST 2:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 7:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 8:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 9:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST10:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST11:PASS : cgroup_attach_task()               Ret Value = 50002       Parameter not created group
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST14:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST15:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST17:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST18:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST19:PASS : cgroup_create_cgroup()             Ret Value = 0   group found under both controllers
TEST20:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST21:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST22:PASS : cgroup_modify_cgroup()             Ret Value = 0   group modified under both controllers
TEST23:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST24:FAIL : cgroup_get_cgroup()                Ret Value = 50018
==5134==
==5134== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 1)
==5134== malloc/free: in use at exit: 66,044 bytes in 15 blocks.
==5134== malloc/free: 279 allocs, 264 frees, 232,094 bytes allocated.
==5134== For counts of detected errors, rerun with: -v
==5134== searching for pointers to 15 not-freed blocks.
==5134== checked 6,381,388 bytes.
==5134==
==5134== 66,044 (18,064 direct, 47,980 indirect) bytes in 4 blocks are definitely lost in loss record 1 of 3
==5134==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==5134==    by 0x4030DAA: cgroup_new_cgroup (wrapper.c:28)
==5134==    by 0x8049656: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1132)
==5134==    by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:744)
==5134==    by 0x804C190: main (libcgrouptest01.c:485)
==5134==
==5134==
==5134== 20,980 bytes in 5 blocks are indirectly lost in loss record 2 of 3
==5134==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==5134==    by 0x4030C3C: cgroup_add_value_string (wrapper.c:122)
==5134==    by 0x8048FDB: _ZL17add_control_valueP17cgroup_controllerPcS1_i (libcgrouptest01.c:1113)
==5134==    by 0x80496C9: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1147)
==5134==    by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:744)
==5134==    by 0x804C190: main (libcgrouptest01.c:485)
==5134==
==5134==
==5134== 27,000 bytes in 6 blocks are indirectly lost in loss record 3 of 3
==5134==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==5134==    by 0x4030F5B: cgroup_add_controller (wrapper.c:62)
==5134==    by 0x80496AE: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1144)
==5134==    by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:744)
==5134==    by 0x804C190: main (libcgrouptest01.c:485)
==5134==
==5134== LEAK SUMMARY:
==5134==    definitely lost: 18,064 bytes in 4 blocks.
==5134==    indirectly lost: 47,980 bytes in 11 blocks.
==5134==      possibly lost: 0 bytes in 0 blocks.
==5134==    still reachable: 0 bytes in 0 blocks.
==5134==         suppressed: 0 bytes in 0 blocks.
Cleanup done
[root@gondor tests]#

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

16 years agolibcgroup: Fix compile warning in cgrulesengd.c
Dhaval Giani [Tue, 6 Jan 2009 07:34:43 +0000 (07:34 +0000)] 
libcgroup: Fix compile warning in cgrulesengd.c

We were getting a warning while compiling on 64 bit platforms,

[root@llm72 trunk]# make
cc -std=gnu99 -DDEBUG -g -O2 -I. -DPACKAGE_VERSION=0.32 -Wall -o cgrulesengd cgrulesengd.c \
                -L . -lcgroup -lpthread
cgrulesengd.c: In function â€˜cgre_create_netlink_socket_process_msg’:
cgrulesengd.c:327: warning: format â€˜%d’ expects type â€˜int’, but argument 3 has type â€˜long unsigned int’

According to Dan Smith, its just an overzealous format check and so
we just cast the size to integer and print it.

Cc: Dan Smith <danms@us.ibm.com>
Cc: Steve Olivieri <steve86@wpi.edu>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@301 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgrouptest: Cleanup valgrind output for libcgroup tests
Dhaval Giani [Mon, 5 Jan 2009 16:25:54 +0000 (16:25 +0000)] 
libcgrouptest: Cleanup valgrind output for libcgroup tests

Fixes a few memory leaks, and leaked file handles.

[root@gondor tests]# make
g++ -g -O2 -Wall -DDEBUG -I .. -o libcgrouptest01 libcgrouptest01.c -L .. -lcgroup -lpthread
libcgrouptest01.c: In function â€˜int group_modified(char*, int)’:
libcgrouptest01.c:1060: warning: format â€˜%d’ expects type â€˜int*’, but argument 3 has type â€˜bool*’
s[root@gondor tests]# sh runlibcgrouptest.sh

Running first set of testcases
==============================
==14758== Memcheck, a memory error detector.
==14758== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==14758== Using LibVEX rev 1804, a library for dynamic binary translation.
==14758== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==14758== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==14758== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==14758== For more details, rerun with: -v
==14758==
C:DBG: fs_mounted as recieved from script=0
TEST 1:PASS : cgroup_init()                      Ret Value = 50001
TEST 2:PASS : cgroup_attach_task()               Ret Value = 50014       Parameter nullcgroup
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 50014
TEST 5:PASS : cgroup_delete_cgroup()             Ret Value = 50014
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 50014
TEST 7:PASS : cgroup_delete_cgroup()             Ret Value = 50014
TEST 8:PASS : cgroup_add_controller()            Ret Value = 0
TEST 9:PASS : cgroup_add_controller()            Ret Value = 0
TEST10:PASS : cgroup_add_controller()            Ret Value = 0
==14758==
==14758== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 1)
==14758== malloc/free: in use at exit: 0 bytes in 0 blocks.
==14758== malloc/free: 18 allocs, 18 frees, 32,293 bytes allocated.
==14758== For counts of detected errors, rerun with: -v
==14758== All heap blocks were freed -- no leaks are possible.

Running second set of testcases
==============================
==14774== Memcheck, a memory error detector.
==14774== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==14774== Using LibVEX rev 1804, a library for dynamic binary translation.
==14774== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==14774== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==14774== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==14774== For more details, rerun with: -v
==14774==
C:DBG: fs_mounted as recieved from script=1
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1
sanity check pass. cgroup
TEST 1:PASS : cgroup_attach_task()               Ret Value = 50014       Parameter nullcgroup
TEST 2:PASS : cgroup_init()                      Ret Value = 0
TEST 3:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 4:PASS : cgroup_attach_task_pid()           Ret Value = 50016
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 7:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x40070D8: strncat (mc_replace_strmem.c:214)
==14774==    by 0x804BC92: main (libcgrouptest01.c:1271)
==14774==
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14774==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14774==    by 0x804BC9D: main (libcgrouptest01.c:252)
==14774==
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14774==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14774==    by 0x804BC9D: main (libcgrouptest01.c:252)
==14774==
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x8049471: _ZL14group_modifiedPci (libcgrouptest01.c:1076)
==14774==    by 0x804C583: main (libcgrouptest01.c:254)
==14774==
==14774==    by 0x804C583: main (libcgrouptest01.c:254)
==14774==
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x8049479: _ZL14group_modifiedPci (libcgrouptest01.c:1076)
==14774==    by 0x804C583: main (libcgrouptest01.c:254)
==14774==
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x4007470: strncmp (mc_replace_strmem.c:314)
==14774==    by 0x804949B: _ZL14group_modifiedPci (libcgrouptest01.c:1076)
==14774==    by 0x804C583: main (libcgrouptest01.c:254)
TEST 8:PASS : cgroup_modify_cgroup()             Ret Value = 0   Parameter same cgroup
TEST 9:PASS : cgroup_new_cgroup()                Ret Value = 0
==14774==
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14774==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14774==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889)
==14774==    by 0x804BD35: main (libcgrouptest01.c:286)
==14774==
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14774==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14774==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889)
==14774==    by 0x804BD35: main (libcgrouptest01.c:286)
TEST10:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST11:PASS : cgroup_modify_cgroup()             Ret Value = 50007
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0
==14774==
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14774==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14774==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889)
==14774==    by 0x804BDF3: main (libcgrouptest01.c:314)
==14774==
==14774== Conditional jump or move depends on uninitialised value(s)
==14774==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14774==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14774==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889)
==14774==    by 0x804BDF3: main (libcgrouptest01.c:314)
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST14:PASS : cgroup_get_cgroup()                Ret Value = 50007       Parameter nullcgroup
TEST15:PASS : cgroup_get_cgroup()                Ret Value = 50002       Parameter not created group
TEST16:PASS : cgroup_get_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST17:FAIL : cgroup_get_cgroup()                Ret Value = 50017
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST17:PASS : cgroup_create_cgroup()             Ret Value = 50007
TEST18:PASS : cgroup_delete_cgroup()             Ret Value = 50007
TEST19:PASS : cgroup_compare_cgroup()            Ret Value = 50011       Parameter nullcgroup
TEST20:PASS : cgroup_compare_cgroup()            Ret Value = 0
TEST21:PASS : cgroup_compare_cgroup()            Ret Value = 50017
==14774==
==14774== ERROR SUMMARY: 45 errors from 10 contexts (suppressed: 18 from 1)
==14774== malloc/free: in use at exit: 0 bytes in 0 blocks.
==14774== malloc/free: 187 allocs, 187 frees, 234,711 bytes allocated.
==14774== For counts of detected errors, rerun with: -v
==14774== All heap blocks were freed -- no leaks are possible.
Cleanup done

Running third set of testcases
==============================
==14827== Memcheck, a memory error detector.
==14827== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==14827== Using LibVEX rev 1804, a library for dynamic binary translation.
==14827== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==14827== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==14827== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==14827== For more details, rerun with: -v
==14827==
C:DBG: fs_mounted as recieved from script=2
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1
C:DBG: mountpoint2 as recieved from script=/dev/cgroup_controllers-2
sanity check pass. cgroup
TEST 1:PASS : cgroup_init()                      Ret Value = 0
TEST 2:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 1:PASS : cgroup_init()                      Ret Value = 0
TEST 2:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 7:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 8:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 9:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST10:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST11:PASS : cgroup_attach_task()               Ret Value = 50002       Parameter not created group
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0
==14827== Conditional jump or move depends on uninitialised value(s)
==14827==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14827==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14827==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889)
==14827==    by 0x804C1D6: main (libcgrouptest01.c:498)
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST14:PASS : cgroup_new_cgroup()                Ret Value = 0
==14827==
==14827== Conditional jump or move depends on uninitialised value(s)
==14827==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14827==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14827==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889)
==14827==    by 0x804C23C: main (libcgrouptest01.c:519)
==14827==
==14827== Conditional jump or move depends on uninitialised value(s)
==14827==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14827==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14827==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889)
==14827==    by 0x804C23C: main (libcgrouptest01.c:519)
TEST15:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST17:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST18:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST19:PASS : cgroup_create_cgroup()             Ret Value = 0   group found under both controllers
TEST20:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST21:PASS : cgroup_new_cgroup()                Ret Value = 0
==14827==
==14827== Conditional jump or move depends on uninitialised value(s)
==14827==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14827==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14827==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889)
==14827==    by 0x804C464: main (libcgrouptest01.c:622)
==14827==
==14827== Conditional jump or move depends on uninitialised value(s)
==14827==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14827==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14827==    by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889)
==14827==    by 0x804C464: main (libcgrouptest01.c:622)
TEST22:PASS : cgroup_modify_cgroup()             Ret Value = 0   group modified under both controllers
TEST23:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST24:FAIL : cgroup_get_cgroup()                Ret Value = 50018
==14827==
==14827== ERROR SUMMARY: 79 errors from 5 contexts (suppressed: 18 from 1)
==14827== malloc/free: in use at exit: 66,044 bytes in 15 blocks.
==14827== malloc/free: 196 allocs, 181 frees, 228,734 bytes allocated.
==14827== For counts of detected errors, rerun with: -v
==14827== searching for pointers to 15 not-freed blocks.
==14827== checked 6,381,180 bytes.
==14827==
==14827==
==14827== 66,044 (18,064 direct, 47,980 indirect) bytes in 4 blocks are definitely lost in loss record 1 of 3
==14827==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14827==    by 0x4030D9A: cgroup_new_cgroup (wrapper.c:28)
==14827==    by 0x8049656: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1132)
==14827==    by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:744)
==14827==    by 0x804C190: main (libcgrouptest01.c:485)
==14827==
==14827==
==14827== 20,980 bytes in 5 blocks are indirectly lost in loss record 2 of 3
==14827==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14827==    by 0x4030C2C: cgroup_add_value_string (wrapper.c:122)
==14827==    by 0x8048FDB: _ZL17add_control_valueP17cgroup_controllerPcS1_i (libcgrouptest01.c:1113)
==14827==    by 0x4030C2C: cgroup_add_value_string (wrapper.c:122)
==14827==    by 0x8048FDB: _ZL17add_control_valueP17cgroup_controllerPcS1_i (libcgrouptest01.c:1113)
==14827==    by 0x80496C9: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1147)
==14827==    by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:744)
==14827==    by 0x804C190: main (libcgrouptest01.c:485)
==14827==
==14827==
==14827== 27,000 bytes in 6 blocks are indirectly lost in loss record 3 of 3
==14827==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14827==    by 0x4030F4B: cgroup_add_controller (wrapper.c:62)
==14827==    by 0x80496AE: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1144)
==14827==    by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:744)
==14827==    by 0x804C190: main (libcgrouptest01.c:485)
==14827==
==14827== LEAK SUMMARY:
==14827==    definitely lost: 18,064 bytes in 4 blocks.
==14827==    indirectly lost: 47,980 bytes in 11 blocks.
==14827==      possibly lost: 0 bytes in 0 blocks.
==14827==    still reachable: 0 bytes in 0 blocks.
==14827==         suppressed: 0 bytes in 0 blocks.
Cleanup done
[root@gondor tests]#

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

16 years agolibcgroup: Fix a few of the valgrind issues
Dhaval Giani [Mon, 5 Jan 2009 16:23:30 +0000 (16:23 +0000)] 
libcgroup: Fix a few of the valgrind issues

This patch fixes the leaks reported by valgrind in the library.

The valgrind output after this patch is applied is,

[root@gondor tests]# sh runlibcgrouptest.sh

Running first set of testcases
==============================
==14406== Memcheck, a memory error detector.
==14406== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==14406== Using LibVEX rev 1804, a library for dynamic binary translation.
==14406== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==14406== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==14406== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==14406== For more details, rerun with: -v
==14406==
C:DBG: fs_mounted as recieved from script=0
TEST 1:PASS : cgroup_init()                      Ret Value = 50001
TEST 2:PASS : cgroup_attach_task()               Ret Value = 50014       Parameter nullcgroup
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 50014
TEST 5:PASS : cgroup_delete_cgroup()             Ret Value = 50014
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 50014
TEST 7:PASS : cgroup_delete_cgroup()             Ret Value = 50014
TEST 8:PASS : cgroup_add_controller()            Ret Value = 0
TEST 9:PASS : cgroup_add_controller()            Ret Value = 0
TEST10:PASS : cgroup_add_controller()            Ret Value = 0
==14406==
==14406== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 1)
==14406== malloc/free: in use at exit: 704 bytes in 2 blocks.
==14406== malloc/free: 18 allocs, 16 frees, 32,293 bytes allocated.
==14406== For counts of detected errors, rerun with: -v
==14406== searching for pointers to 2 not-freed blocks.
==14406== checked 6,389,612 bytes.
==14406==
==14406== 704 bytes in 2 blocks are still reachable in loss record 1 of 1
==14406==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==14406==    by 0x4C2AC78E: __fopen_internal (in /lib/libc-2.9.so)
==14406==    by 0x4C2AC85B: fopen@@GLIBC_2.1 (in /lib/libc-2.9.so)
==14406==    by 0x8049155: get_controllers(char const*, int*) (libcgrouptest01.c:979)
==14406==    by 0x804B589: main (libcgrouptest01.c:84)
==14406==
==14406== LEAK SUMMARY:
==14406==    definitely lost: 0 bytes in 0 blocks.
==14406==      possibly lost: 0 bytes in 0 blocks.
==14406==    still reachable: 704 bytes in 2 blocks.
==14406==         suppressed: 0 bytes in 0 blocks.

Running second set of testcases
==============================
==14422== Memcheck, a memory error detector.
==14422== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==14422== Using LibVEX rev 1804, a library for dynamic binary translation.
==14422== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==14422== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==14422== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==14422== For more details, rerun with: -v
==14422==
C:DBG: fs_mounted as recieved from script=1
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1
sanity check pass. cgroup
TEST 1:PASS : cgroup_attach_task()               Ret Value = 50014       Parameter nullcgroup
TEST 2:PASS : cgroup_init()                      Ret Value = 0
TEST 3:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 4:PASS : cgroup_attach_task_pid()           Ret Value = 50016
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 7:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x40070D8: strncat (mc_replace_strmem.c:214)
==14422==    by 0x804BAAA: main (libcgrouptest01.c:1255)
==14422==
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14422==    by 0x804BAB5: main (libcgrouptest01.c:251)
==14422==
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14422==    by 0x804BAB5: main (libcgrouptest01.c:251)
==14422==
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x8049381: _ZL14group_modifiedPci (libcgrouptest01.c:1072)
==14422==    by 0x804C367: main (libcgrouptest01.c:253)
==14422==
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x8049389: _ZL14group_modifiedPci (libcgrouptest01.c:1072)
==14422==    by 0x804C367: main (libcgrouptest01.c:253)
==14422==
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x4007470: strncmp (mc_replace_strmem.c:314)
==14422==    by 0x80493A9: _ZL14group_modifiedPci (libcgrouptest01.c:1072)
==14422==    by 0x804C367: main (libcgrouptest01.c:253)
TEST 8:PASS : cgroup_modify_cgroup()             Ret Value = 0   Parameter same cgroup
TEST 9:PASS : cgroup_new_cgroup()                Ret Value = 0
==14422==
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14422==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:888)
==14422==    by 0x804BB41: main (libcgrouptest01.c:285)
==14422==
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14422==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:888)
==14422==    by 0x804BB41: main (libcgrouptest01.c:285)
TEST10:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST11:PASS : cgroup_modify_cgroup()             Ret Value = 50007
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0
==14422==
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14422==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:888)
==14422==    by 0x804BBF3: main (libcgrouptest01.c:313)
==14422==
==14422== Conditional jump or move depends on uninitialised value(s)
==14422==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14422==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14422==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:888)
==14422==    by 0x804BBF3: main (libcgrouptest01.c:313)
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST14:PASS : cgroup_get_cgroup()                Ret Value = 50007       Parameter nullcgroup
TEST15:PASS : cgroup_get_cgroup()                Ret Value = 50002       Parameter not created group
TEST16:PASS : cgroup_get_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST17:FAIL : cgroup_get_cgroup()                Ret Value = 50017
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST17:PASS : cgroup_create_cgroup()             Ret Value = 50007
TEST18:PASS : cgroup_delete_cgroup()             Ret Value = 50007
TEST19:PASS : cgroup_compare_cgroup()            Ret Value = 50011       Parameter nullcgroup
TEST20:PASS : cgroup_compare_cgroup()            Ret Value = 0
TEST21:PASS : cgroup_compare_cgroup()            Ret Value = 50017
==14422==
==14422== ERROR SUMMARY: 45 errors from 10 contexts (suppressed: 18 from 1)
==14422== malloc/free: in use at exit: 7,356 bytes in 10 blocks.
==14422== malloc/free: 187 allocs, 177 frees, 234,711 bytes allocated.
==14422== For counts of detected errors, rerun with: -v
==14422== searching for pointers to 10 not-freed blocks.
==14422== checked 6,415,132 bytes.
==14422==
==14422==
==14422== 24 bytes in 1 blocks are definitely lost in loss record 1 of 3
==14422==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==14422==    by 0x8048FF7: check_fsmounted(int) (libcgrouptest01.c:1171)
==14422==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==14422==    by 0x8048FF7: check_fsmounted(int) (libcgrouptest01.c:1171)
==14422==    by 0x804B86B: main (libcgrouptest01.c:168)
==14422==
==14422==
==14422== 2,816 bytes in 8 blocks are still reachable in loss record 2 of 3
==14422==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==14422==    by 0x4C2AC78E: __fopen_internal (in /lib/libc-2.9.so)
==14422==    by 0x4C2AC85B: fopen@@GLIBC_2.1 (in /lib/libc-2.9.so)
==14422==    by 0x8049155: get_controllers(char const*, int*) (libcgrouptest01.c:979)
==14422==    by 0x804B589: main (libcgrouptest01.c:84)
==14422==
==14422==
==14422== 4,516 bytes in 1 blocks are definitely lost in loss record 3 of 3
==14422==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14422==    by 0x4030D9A: cgroup_new_cgroup (wrapper.c:28)
==14422==    by 0x804B056: test_cgroup_get_cgroup(int, int, int) (libcgrouptest01.c:1342)
==14422==    by 0x804BC07: main (libcgrouptest01.c:324)
==14422==
==14422== LEAK SUMMARY:
==14422==    definitely lost: 4,540 bytes in 2 blocks.
==14422==      possibly lost: 0 bytes in 0 blocks.
==14422==    still reachable: 2,816 bytes in 8 blocks.
==14422==         suppressed: 0 bytes in 0 blocks.
Cleanup done

Running third set of testcases
==============================
==14473== Memcheck, a memory error detector.
==14473== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==14473== Using LibVEX rev 1804, a library for dynamic binary translation.
==14473== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==14473== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==14473== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==14473== For more details, rerun with: -v
==14473==
C:DBG: fs_mounted as recieved from script=2
C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1
C:DBG: mountpoint2 as recieved from script=/dev/cgroup_controllers-2
sanity check pass. cgroup
TEST 1:PASS : cgroup_init()                      Ret Value = 0
TEST 2:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 3:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 4:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 5:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 6:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 7:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST 8:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST 9:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST10:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST11:PASS : cgroup_attach_task()               Ret Value = 50002       Parameter not created group
TEST12:PASS : cgroup_new_cgroup()                Ret Value = 0
==14473== Conditional jump or move depends on uninitialised value(s)
==14473==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804BFB4: main (libcgrouptest01.c:497)
TEST13:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST14:PASS : cgroup_new_cgroup()                Ret Value = 0
==14473==
==14473== Conditional jump or move depends on uninitialised value(s)
==14473==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804C014: main (libcgrouptest01.c:518)
==14473==
==14473== Conditional jump or move depends on uninitialised value(s)
==14473==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804C014: main (libcgrouptest01.c:518)
TEST15:PASS : cgroup_modify_cgroup()             Ret Value = 0
TEST16:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST17:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST18:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST19:PASS : cgroup_create_cgroup()             Ret Value = 0   group found under both controllers
TEST18:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST19:PASS : cgroup_create_cgroup()             Ret Value = 0   group found under both controllers
TEST20:PASS : cgroup_attach_task()               Ret Value = 0   Task found in group/s
TEST21:PASS : cgroup_new_cgroup()                Ret Value = 0
==14473==
==14473== Conditional jump or move depends on uninitialised value(s)
==14473==    at 0x4007271: strcpy (mc_replace_strmem.c:268)
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804C240: main (libcgrouptest01.c:621)
==14473==
==14473== Conditional jump or move depends on uninitialised value(s)
==14473==    at 0x4007285: strcpy (mc_replace_strmem.c:268)
==14473==    by 0x402F24B: cgroup_modify_cgroup (api.c:1012)
==14473==    by 0x804A317: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:888)
==14473==    by 0x804C240: main (libcgrouptest01.c:621)
TEST22:PASS : cgroup_modify_cgroup()             Ret Value = 0   group modified under both controllers
TEST23:PASS : cgroup_delete_cgroup()             Ret Value = 0   Group deleted from filesystem
TEST 0:PASS : cgroup_new_cgroup()                Ret Value = 0
TEST 0:PASS : cgroup_create_cgroup()             Ret Value = 0   group found in filesystem
TEST24:FAIL : cgroup_get_cgroup()                Ret Value = 50018
==14473==
==14473== ERROR SUMMARY: 79 errors from 5 contexts (suppressed: 18 from 1)
==14473== malloc/free: in use at exit: 71,348 bytes in 31 blocks.
==14473== malloc/free: 196 allocs, 165 frees, 228,734 bytes allocated.
==14473== For counts of detected errors, rerun with: -v
==14473== searching for pointers to 31 not-freed blocks.
==14473== checked 6,444,900 bytes.
==14473==
==14473==
==14473== 24 bytes in 1 blocks are definitely lost in loss record 1 of 5
==14473==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==14473==    by 0x8048FF7: check_fsmounted(int) (libcgrouptest01.c:1171)
==14473==    by 0x804BD43: main (libcgrouptest01.c:360)
==14473==
==14473==
==14473== 5,280 bytes in 15 blocks are still reachable in loss record 2 of 5
==14473==    at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==14473==    by 0x4C2AC78E: __fopen_internal (in /lib/libc-2.9.so)
==14473==    by 0x4C2AC85B: fopen@@GLIBC_2.1 (in /lib/libc-2.9.so)
==14473==    by 0x8049155: get_controllers(char const*, int*) (libcgrouptest01.c:979)
==14473==    by 0x804B589: main (libcgrouptest01.c:84)
==14473==
==14473==
==14473== 66,044 (18,064 direct, 47,980 indirect) bytes in 4 blocks are definitely lost in loss record 3 of 5
==14473==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14473==    by 0x4030D9A: cgroup_new_cgroup (wrapper.c:28)
==14473==    by 0x8049586: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1127)
==14473==    by 0x8049847: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:743)
==14473==    by 0x804BF74: main (libcgrouptest01.c:484)
==14473==
==14473==
==14473== 20,980 bytes in 5 blocks are indirectly lost in loss record 4 of 5
==14473==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14473==    by 0x4030C2C: cgroup_add_value_string (wrapper.c:122)
==14473==    by 0x8048F3B: _ZL17add_control_valueP17cgroup_controllerPcS1_i (libcgrouptest01.c:1108)
==14473==    by 0x80495F9: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1142)
==14473==    by 0x8049847: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:743)
==14473==    by 0x804BF74: main (libcgrouptest01.c:484)
==14473==
==14473==
==14473== 27,000 bytes in 6 blocks are indirectly lost in loss record 5 of 5
==14473==    at 0x4004BA2: calloc (vg_replace_malloc.c:397)
==14473==    by 0x4030F4B: cgroup_add_controller (wrapper.c:62)
==14473==    by 0x80495DE: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1139)
==14473==    by 0x8049847: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:743)
==14473==    by 0x804BF74: main (libcgrouptest01.c:484)
==14473==
==14473== LEAK SUMMARY:
==14473==    definitely lost: 18,088 bytes in 5 blocks.
==14473==    indirectly lost: 47,980 bytes in 11 blocks.
==14473==      possibly lost: 0 bytes in 0 blocks.
==14473==    still reachable: 5,280 bytes in 15 blocks.
==14473==         suppressed: 0 bytes in 0 blocks.
Cleanup done

The cgroup_modify_cgroup uninitialized error is fixed in the clean up
patches.

After this patch, there are no leaks in the library as per the test
cases and valgrind. (The cgroup data structure has to be explictly
freed by the caller, so it is not a leak in the library)

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
---
 api.c |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

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

16 years agolibcgroup: Intialize all pointers in api.c
Dhaval Giani [Mon, 5 Jan 2009 16:20:44 +0000 (16:20 +0000)] 
libcgroup: Intialize all pointers in api.c

Recently, while debugging an issue with test cases, I realized the
pitfalls of not initializing your pointers. On looking into api.c,
I realized that a lot of pointers are not initialized. Hence, this
patch.

Tested against the libcgrouptest suite. No regressions could be
were observed.

Balbir says,

> We should avoid double initialization specially if a
>
> *ptr = NULL is followed by
> ptr = malloc(...)
>
> I don't see any concerns right now, but something to be aware of

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

16 years agolibcgrouptest: Initialize uninitialized pointers in test cases
Dhaval Giani [Fri, 2 Jan 2009 16:52:49 +0000 (16:52 +0000)] 
libcgrouptest: Initialize uninitialized pointers in test cases

Pointers should be initialized to NULL. In the multi mount test case
path, we had an uninitialized cgroup_filled which caused a
segmentation fault. Fix it for this test case.

TODO:
Fix for all test cases.

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

16 years agolibcgroup: Fix pam_cgroup.so Makefile dependency
Dhaval Giani [Tue, 30 Dec 2008 14:16:08 +0000 (14:16 +0000)] 
libcgroup: Fix pam_cgroup.so Makefile dependency

pam_cgroup.so depends on libcgroup.so

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

16 years agolibcgrouptest: Change the dynamic creation of messages to static 2d array
Dhaval Giani [Tue, 30 Dec 2008 13:33:16 +0000 (13:33 +0000)] 
libcgrouptest: Change the dynamic creation of messages to static 2d array

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

This is addressing all the comments on the list and others too.

Earlier we were creating the messgae array dynamicaly which is not required
as the messages do not change dynamicaly. Let us have a static 2D array of
messages. This patch does that.
(This addresses the comment on the list ;))

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

16 years agolibcgroup: v0.32.2
Dhaval Giani [Mon, 29 Dec 2008 12:28:12 +0000 (12:28 +0000)] 
libcgroup: v0.32.2

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

16 years agolibcgroup: Don't fail cgroup_get_cgroup if fscanf fails
Dhaval Giani [Mon, 29 Dec 2008 07:05:54 +0000 (07:05 +0000)] 
libcgroup: Don't fail cgroup_get_cgroup if fscanf fails

cgroup_get_cgroup was failing with the memory controller enabled. It was
failing on memory.force_empty. The file has read permissions, but there
is no read routine associated with it inside the kernel. fscanf failed
and so cgroup_get_cgroup also failed. This was unexpected,
cgroup_get_cgroup should have just skipped the file. In order to fix
this, change cg_rd_ctrl_file to return more descriptive errors.

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

16 years agolibcgroup: test for cgroup_add/free_controller
Dhaval Giani [Mon, 22 Dec 2008 19:06:14 +0000 (19:06 +0000)] 
libcgroup: test for cgroup_add/free_controller

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

This patch adds testcases for cgroup_add_controller() wrapper api.

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

16 years agolibcgroup: test for cgroup_get_cgroup
Dhaval Giani [Mon, 22 Dec 2008 19:04:55 +0000 (19:04 +0000)] 
libcgroup: test for cgroup_get_cgroup

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

This patch adds one testcase for cgroup_get_cgroup() api.
The test creates a group in filesystem, reads it in another
cgroup and compares the two and throws the results.
Also bounds the execution of certain basic testcases for the
same api under single mount only, as not required under multimnt.

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

16 years agolibcgroup: one more test for cgroup_get_cgroup
Dhaval Giani [Mon, 22 Dec 2008 19:03:41 +0000 (19:03 +0000)] 
libcgroup: one more test for cgroup_get_cgroup

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

The following patch adds a scenario for testing cgroup_get_cgroup()
api. The test is called with a cgroup which has not been created yet.

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

16 years agolibcgroup: replace numbers by meaningful macros
Dhaval Giani [Mon, 22 Dec 2008 19:02:07 +0000 (19:02 +0000)] 
libcgroup: replace numbers by meaningful macros

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

This patch replaces the magic numbers from the info messages with the
corresponding meaningful enums.

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

16 years agolibcgroup: create function for cgroup_modify_cgroup
Dhaval Giani [Mon, 22 Dec 2008 19:00:20 +0000 (19:00 +0000)] 
libcgroup: create function for cgroup_modify_cgroup

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

This patch creates the function test_cgroup_modify_cgroup(), to modify 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.

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

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