]> git.ipfire.org Git - thirdparty/libcgroup.git/log
thirdparty/libcgroup.git
16 years agoChangelog v2:
\"Ken'ichi Ohmichi\ [Thu, 7 May 2009 20:16:02 +0000 (01:46 +0530)] 
Changelog v2:
 * Use clock_gettime(2) for getting timestamp since a system boot.
 * Change parent_info's memory to dynamic allocation.

This patch is for changing the cgroup of a forked process while parent
changing.

This patch adds the following sequence:
 1. Store both the timestamp and the process-id when changing the cgroup.
 2. If receiving a PROC_EVENT_FORK packet, check its parent-pid and its
    timestamp.
 3. If its parent-pid and the stored process-id are same and its timestamp
    is older than the stored timestamp, change the cgroup of forked process.

Thanks
Ken'ichi Ohmichi

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
16 years agoI have been testing a cgrulesengd daemon and I noticed it fails to
\"Ken'ichi Ohmichi\ [Thu, 7 May 2009 19:57:46 +0000 (01:27 +0530)] 
I have been testing a cgrulesengd daemon and I noticed it fails to
change the cgroup of child occasionally. I tested it by following
configulation file:

/etc/cgrules.conf:
    user01          cpuset          group01/user01
    %               memory          group01/user01

A cpuset subsystem and a memory subsystem are mounted on different
mount points, and a cgrulesengd daemon manages each subsystem.
I login this environment as a user "user01", and each susbystem's
tasks file is the following:

 # cat /mnt/cgroups/cpuset/group01/user01/tasks
 31801
 31805
 31806
 #
 # cat /mnt/cgroups/memory/group01/user01/tasks
 31801
 31805
 #
 # pstree -p 32105
 sshd(31801)---sshd(31805)---bash(31806)
 #

They should be the same, but they are different. I investigated this
problem, and I found the cause. The reason is that the process(31806)
was forked just after writing the process(31805) to a cpuset subsystem's
tasks file:

 <1> The UID/GID CHANGE event of the process 31805 happens.
 <2> The daemon writes "31805" to a cpuset subsystem's tasks file.
 <3> The process 31806 is forked, and it appears on a cpuset subsystem's
     tasks file.
 <4> The daemon writes "31805" to a memory subsystem's tasks file.
 <5> The process 31806 does not appears on a memory subsystem's tasks file.

For solving this problem, I propose the following sequence.
 1. Store both the timestamp and the process-id when the step <4>.
 2. If receiving a PROC_EVENT_FORK packet, check its parent-pid and its
    timestamp.
 3. If its parent-pid and the stored process-id are same and its timestamp
    is older than the stored timestamp, change the cgroup of forked process.

Changelog of v2:
 * Change only [PATCH 2/2] and there is not any changes in [PATCH 1/2].

This patch adds the method for getting euid/egid from /proc/<pid>/status
file.

For changing the cgroup of a forked process, the method is usefull because
a PROC_EVENT_FORK packet does not inform of its euid and its egid.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
16 years agoMerge branch 'master' of ssh://balbir_singh@libcg.git.sourceforge.net/gitroot/libcg
Balbir Singh [Fri, 24 Apr 2009 04:22:14 +0000 (09:52 +0530)] 
Merge branch 'master' of ssh://balbir_singh@libcg.git.sourceforge.net/gitroot/libcg

16 years agolibcgroup: Correct the version to which the statistics API belong
Dhaval Giani [Wed, 22 Apr 2009 10:18:18 +0000 (15:48 +0530)] 
libcgroup: Correct the version to which the statistics API belong

These APIs were not available in v0.33. They will be a part of
v0.34 however. Make the change in libcgroup.map reflecting this.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agolibcgroup: Add test cases for new get_task API
Dhaval Giani [Wed, 22 Apr 2009 10:00:20 +0000 (15:30 +0530)] 
libcgroup: Add test cases for new get_task API

This is the test case for the new API. This test takes one argument, the
group name.

Sample run on my system with this test case returns,

[dhaval@gondor tests]$ ../libtool --mode=execute ./walk_task a
Printing the details of groups a
Pid is 6092
Pid is 11315
Pid is 11318
Pid is 11319
Pid is 11324
Pid is 13234
[dhaval@gondor tests]$

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
16 years agolibcgroup: Add new API to walk tasks
Dhaval Giani [Wed, 22 Apr 2009 10:00:19 +0000 (15:30 +0530)] 
libcgroup: Add new API to walk tasks

Add a new API to iterate through the tasks file to get
the list of all the tasks in a cgroup.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
16 years agoMerge branch 'master' of ssh://balbir_singh@libcg.git.sourceforge.net/gitroot/libcg
Balbir Singh [Tue, 21 Apr 2009 08:57:28 +0000 (14:27 +0530)] 
Merge branch 'master' of ssh://balbir_singh@libcg.git.sourceforge.net/gitroot/libcg

16 years agoFix a few compilation warnings in api.c
Bharata B Rao [Mon, 13 Apr 2009 10:19:06 +0000 (15:49 +0530)] 
Fix a few compilation warnings in api.c

gcc -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -Wall -MT api.lo -MD -MP -MF .deps/api.Tpo -c api.c  -fPIC -DPIC -o .libs/api.o
api.c:52:1: warning: "VERSION" redefined
In file included from ./libcgroup-internal.h:21,
                 from api.c:31:
../config.h:129:1: warning: this is the location of the previous definition
api.c: In function 'cgroup_parse_rules':
api.c:353: warning: implicit declaration of function 'isblank'
api.c: In function 'cgroup_modify_cgroup':
api.c:1073: warning: implicit declaration of function 'asprintf'

This patch fixes the warning arising due to isblank, asprintf and getline.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoRemove the dependency of libcgroup on libcgroup build.
Bharata B Rao [Mon, 6 Apr 2009 08:47:38 +0000 (14:17 +0530)] 
Remove the dependency of libcgroup on libcgroup build.

libcgroup build checks for the availability of cgroup_creat_cgroup
from libcgroup during its build. This causes a build failure if
libcgroup is compiled in a system which already has libcgroup library
installed.

Remove this check from configure.in.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoFix the lacks of pthread_rwlock_unlock() calls.
Ken'ichi Ohmichi [Mon, 13 Apr 2009 00:47:36 +0000 (09:47 +0900)] 
Fix the lacks of pthread_rwlock_unlock() calls.

Two pthread_rwlock_unlock() calls are necessary if *cgroup is null
and fprintf()/fflush() fails in cgroup_attach_task_pid():

 src/api.c:785
 785             pthread_rwlock_rdlock(&cg_mount_table_lock);
 786             for(i = 0; i < CG_CONTROLLER_MAX &&
 787                             cg_mount_table[i].name[0]!='\0'; i++) {
 [snip]
 805                     ret = fprintf(tasks, "%d", tid);
 806                     if (ret < 0) {
    <<pthread_rwlock_unlock() call is necessary>>
 807                             cgroup_dbg("Error writing tid %d to
%s:%s\n",
 808                                             tid, path,
strerror(errno));
 809                             fclose(tasks);
 810                             last_errno = errno;
 811                             return ECGOTHER;
 812                     }
 813
 814                     ret = fflush(tasks);
 815                     if (ret) {
    <<pthread_rwlock_unlock() call is necessary>>
 816                             last_errno = errno;
 817                             cgroup_dbg("Error writing tid  %d to
%s:%s\n",
 818                                              tid, path,
strerror(errno));
 819                              fclose(tasks);
 820                              return ECGOTHER;
 821                      }

For the readability, this patch merges almost the same lines into one
function(__cgroup_attach_task_pid()) and adds pthread_rwlock_unlock()
call for the case the function fails.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoFix infinite loop if receiving a NLMSG_NOOP packet.
Ken'ichi Ohmichi [Tue, 7 Apr 2009 05:02:24 +0000 (14:02 +0900)] 
Fix infinite loop if receiving a NLMSG_NOOP packet.

Hi,

I tested 'cgred' service and I saw the problem that some processes
are not moved to a right cgroup. This problem did not occur always,
and it did sometimes. I reviewed cgrulesengd.c and found the bug
cgrulesengd stays in an infinite loop if receiving a NLMSG_NOOP
packet.

This patch fixes this problem.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoAdd some success/error messages to 'cgred' service.
Ken'ichi Ohmichi [Tue, 7 Apr 2009 00:50:32 +0000 (09:50 +0900)] 
Add some success/error messages to 'cgred' service.

Hi,

The existing 'cgred' service displays a success message ([ OK ]) when
the service is starting, but it does not display any messages when it
is stopping/reloading. So this patch adds some success/error messages
to 'cgred' service like the following:

 # service cgred start
 Starting CGroup Rules Engine Daemon...
                                                            [  OK  ]
 #

 # service cgred stop
 Stopping CGroup Rules Engine Daemon...
                                                            [  OK  ]
 #

 # service cgred restart
 Stopping CGroup Rules Engine Daemon...
                                                            [  OK  ]
 Starting CGroup Rules Engine Daemon...
                                                            [  OK  ]
 #

 # service cgred reload
 Reloading rules configuration...
                                                            [  OK  ]
 #

This patch's purpose is almost same as the one of 'cgconfig' service:
http://sourceforge.net/mailarchive/forum.php?thread_name=49D9B778.3000900%40mxs.nes.nec.co.jp&forum_name=libcg-devel

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoAdd some success/error messages to 'cgconfig' service.
Ken'ichi Ohmichi [Mon, 6 Apr 2009 08:04:08 +0000 (17:04 +0900)] 
Add some success/error messages to 'cgconfig' service.

Hi,

The existing 'cgconfig' service does not display any message even if it
succeeds. So this patch adds some success/error messages to 'cgconfig'
service like the following:

 # service cgconfig start
 Starting cgconfig service:                                 [  OK  ]
 #

 # service cgconfig stop
 Stopping cgconfig service:                                 [  OK  ]
 #

 # service cgconfig restart
 Stopping cgconfig service:                                 [  OK  ]
 Starting cgconfig service:                                 [  OK  ]
 #

It makes test of 'cgconfig' service a little easy.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoFurther removal of files based on review comments from Jan
Balbir Singh [Fri, 3 Apr 2009 03:25:10 +0000 (08:55 +0530)] 
Further removal of files based on review comments from Jan

config.guess config.sub, depcomp, install-sh and ylwrap removed

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
16 years agoRemove autogenerated files and update documentation. More documentation
Balbir Singh [Wed, 1 Apr 2009 14:51:09 +0000 (20:21 +0530)] 
Remove autogenerated files and update documentation. More documentation
updates will be needed and will be done in subsequent cleanups.

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
16 years agoHere is the v2 of the patch which introduces APIs to read controller
Bharata B Rao [Wed, 1 Apr 2009 05:59:19 +0000 (11:29 +0530)] 
Here is the v2 of the patch which introduces APIs to read controller
specific stats. Added Makefile.am updates which I had missed in the
previous post.

New APIs to read controller specific statistics.

This patch introduces 3 new APIs which can be used to read controller
statistics iteratively. (Eg. stats from memory.stat etc)

Reading of stats is initiated by cgroup_read_stats_begin() API, which
returns the first stat of the requested controller in addition to returing
a handle that should be used in subsequent reads.

cgroup_read_stats_next() API can be used to read the remaining stats
one by one. This needs the handle returned by cgroup_read_stats_begin().

cgroup_read_stats_end() API will terminate the stats reading iteration
initiated by cgroup_read_stats_begin().

Changelog:

v2
- Update tests/Makefile.am so that it generates appropriate rules
  for tests/read_stats.c in the Makefile. This is in addition to
  the manual updates done to the generated file tests/Makefile.in.

v1
- cgroup_read_stats apis now work with relative cgroup path names instead
  of absolute path names.

v0
- Initial post.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
16 years agoAdd free() call for error handling.
Ken'ichi Ohmichi [Tue, 31 Mar 2009 02:05:26 +0000 (11:05 +0900)] 
Add free() call for error handling.

I reviewed the libcgroup code in the viewpoint of memory-leak and
found a lack of free(). This patch adds a free() call for error
handling.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoAdd fclose() calls for error handling
Ken'ichi Ohmichi [Tue, 31 Mar 2009 02:18:27 +0000 (11:18 +0900)] 
Add fclose() calls for error handling

I reviewed the libcgroup code in the viewpoint of memory-leak and
found some lacks of fclose(). This patch adds some fclose() calls
for error handling.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoNo matter how often I test, some last-minute change screws everything up...
Jan Safranek [Mon, 30 Mar 2009 10:24:42 +0000 (15:54 +0530)] 
No matter how often I test, some last-minute change screws everything up...
This time I added duplicate -version-number argument in src/Makefile.am, which
results in following compilation error:

libtool: link: CURRENT `' must be a nonnegative integer
libtool: link: `-version-number' is not valid version information

See the patch below, how it should look like.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoMerge branch 'automake-and-spec-tuning' of git://fedorapeople.org/~jsafrane/libcg
Dhaval Giani [Thu, 26 Mar 2009 15:24:50 +0000 (20:54 +0530)] 
Merge branch 'automake-and-spec-tuning' of git://fedorapeople.org/~jsafrane/libcg

16 years agoMerge branch 'automake' of git://fedorapeople.org/~jsafrane/libcg
Dhaval Giani [Thu, 26 Mar 2009 15:23:17 +0000 (20:53 +0530)] 
Merge branch 'automake' of git://fedorapeople.org/~jsafrane/libcg

16 years agoGenerate .tar.bz2 on 'make dist'
Jan Safranek [Thu, 26 Mar 2009 14:10:09 +0000 (15:10 +0100)] 
Generate .tar.bz2 on 'make dist'

Automatically generate libcgroup*.tar.bz2 on 'make dist'. Some restructure
of AC_INIT and AM_INIT was needed to archieve this and correct output
filename.

Namely AC_INIT( [package], ... ) is used as resulting tarball file name now.

Also run automake and autoconf to refresh the generated stuff... Only
configure.in contains manual changes, everything else is autoconf/automake
bloat :(.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoUpdate the .spec file
Jan Safranek [Thu, 26 Mar 2009 14:10:09 +0000 (15:10 +0100)] 
Update the .spec file

Update the .spec file to reflect automake and autoconf changes. Distribute
the files to the right directories.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoRework the way how so version is defined
Jan Safranek [Thu, 26 Mar 2009 14:10:09 +0000 (15:10 +0100)] 
Rework the way how so version is defined

Make the shared object version a bit more usable, the notation with double
colons cannot be used on different places (see next patch).

Also run automake && autoconf to refresh the generated stuff.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoInstall cgconfigparser to /sbin
Jan Safranek [Thu, 26 Mar 2009 14:10:09 +0000 (15:10 +0100)] 
Install cgconfigparser to /sbin

cgconfigparser can be executed only by root, so it should be installed to
/sbin directory.

Also run automake to update Makefile.in with this change.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoGenerate everything
Jan Safranek [Thu, 26 Mar 2009 14:04:43 +0000 (15:04 +0100)] 
Generate everything

Finally run autoreconf -f -i to generate all the stuff that should be generated

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoFix compilation of some stuff
Jan Safranek [Thu, 26 Mar 2009 14:04:41 +0000 (15:04 +0100)] 
Fix compilation of some stuff

yacc does not generate y.tab.h, it has different name now.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoAdd warrning when test script is started by normal user
Jan Safranek [Thu, 26 Mar 2009 14:04:36 +0000 (15:04 +0100)] 
Add warrning when test script is started by normal user

The runlibcgrouptest.sh will now whine when script is started by non-root
user. Root permissions are needed to create directories and mount the cgroups
there.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoFix runlibcgrouptest.sh exit codes
Jan Safranek [Wed, 25 Mar 2009 09:28:39 +0000 (10:28 +0100)] 
Fix runlibcgrouptest.sh exit codes

Automake's 'make check' executes runlibcgrouptest.sh automatically. It
interprets exit code '77' as 'skip the test' and it is not counted as failure.

Also the script should return nozero exit code != 77 when some test fails.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoDisable compilation of static libraries
Jan Safranek [Wed, 25 Mar 2009 09:28:34 +0000 (10:28 +0100)] 
Disable compilation of static libraries

Disable compilation of static libraries. Static libraries (.a files) should not
be compiled by default, shared library is better for LGPL licensed code.

Still, one can enable static libraries with ./configure --enable-static

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoMake runlibcgrouptest.sh executable
Jan Safranek [Wed, 25 Mar 2009 09:25:44 +0000 (10:25 +0100)] 
Make runlibcgrouptest.sh executable

runlibcgrouptest.sh should be executable, so 'make check' can execute it.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoAdd automake makefiles
Jan Safranek [Fri, 13 Mar 2009 14:16:20 +0000 (15:16 +0100)] 
Add automake makefiles

Add automake makefiles and prepare everything to run, but don't actually
run the automake - it would generate lot of noise, where my manual changes
would get lots.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoClean up the scripts directory
Jan Safranek [Fri, 13 Mar 2009 14:16:20 +0000 (15:16 +0100)] 
Clean up the scripts directory

The directory contains samples and howto, which is not relevant anymore.
Sample configuration files should be in ../samples and (relevant)
documentation in ../doc

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoRemove wml samples
Jan Safranek [Fri, 13 Mar 2009 14:16:20 +0000 (15:16 +0100)] 
Remove wml samples

The samples are not relevant anymore?

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoRemove mktarball
Jan Safranek [Fri, 13 Mar 2009 14:16:20 +0000 (15:16 +0100)] 
Remove mktarball

The mktarball script is not needed anymore use 'make dist' instead.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoRemove tests/Makefile
Jan Safranek [Fri, 13 Mar 2009 14:16:19 +0000 (15:16 +0100)] 
Remove tests/Makefile

Remove tests/Makefile, it will be replaced by automake generated one.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agoDistribute files to various subdirectories
Jan Safranek [Fri, 13 Mar 2009 14:16:19 +0000 (15:16 +0100)] 
Distribute files to various subdirectories

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
16 years agolibcgroup: Version bump
Dhaval Giani [Thu, 26 Mar 2009 08:31:15 +0000 (14:01 +0530)] 
libcgroup: Version bump

Start the v0.34 cycle for development.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoMinor fix to cgconfig init script
Ivana Varekova [Wed, 25 Mar 2009 07:55:57 +0000 (08:55 +0100)] 
Minor fix to cgconfig init script

cgconfig script does not test the return value of cgconfigparser command
so it continues to simulate start of the service, even if it was not pass
successfuly.

This is the first part of the patch from:
http://sourceforge.net/mailarchive/forum.php?thread_name=20090120121851.GC4422%40linux.vnet.ibm.com&forum_name=libcg-devel

which was not incorporated yet.

Signed-off-by: Ivana Varekova <varekova@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoFix of the return values
Ivana Varekova [Fri, 20 Mar 2009 12:45:00 +0000 (13:45 +0100)] 
Fix of the return values

This patch fixes a few error values in api.c file.

Signed-off-by: Ivana Varekova <varekova@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoAdd PACKAGE_VERSION to Makefile
Jan Safranek [Mon, 2 Mar 2009 12:09:16 +0000 (13:09 +0100)] 
Add PACKAGE_VERSION to Makefile

By removing PACKAGE_VERSION in SVN rev. 344 I broke 'make install' - the macro
must be defined there, 'make install' needs it to build library symlinks.

I am sorry, I should have noticed it earlier.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoMove binaries and libraries to /bin and /lib
Jan Safranek [Sun, 8 Mar 2009 21:43:59 +0000 (22:43 +0100)] 
Move binaries and libraries to /bin and /lib

Since cgconfig starts before nfs shares are mounted, it should not use
anything on /usr (it can be on nfs too). All the libcgroup libraries and
binaries should be therefore in /.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoStart the config earlier
Jan Safranek [Sun, 8 Mar 2009 21:43:51 +0000 (22:43 +0100)] 
Start the config earlier

We could start cgconfig service earlier, even before network and syslog.
$local_fs is not needed, because /bin, /sbin and /etc are guaranteed by
rc.sysinit (see Fedora bug #309001,
https://bugzilla.redhat.com/show_bug.cgi?id=309001).

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agolibcgroup: Initialize buffer in config.c
Dhaval Giani [Wed, 4 Mar 2009 11:38:53 +0000 (17:08 +0530)] 
libcgroup: Initialize buffer in config.c

Fix the warning,
config.c: In function ‘cgroup_config_parse_controller_options’:
config.c:104: warning: ‘buffer’ may be used uninitialized in this function

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agolibcgroup: Removed unused functions from api.c
Dhaval Giani [Wed, 4 Mar 2009 11:29:49 +0000 (16:59 +0530)] 
libcgroup: Removed unused functions from api.c

api.c: At top level:
api.c:1780: warning: ‘cg_prepare_controller_array’ defined but not used
api.c:1805: warning: ‘cg_free_controller_array’ defined but not used

Turns out no one is using this functions. Remove them.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agolibcgroup: Fix unused variable warnings for the walk_tree API
Dhaval Giani [Wed, 4 Mar 2009 11:25:35 +0000 (16:55 +0530)] 
libcgroup: Fix unused variable warnings for the walk_tree API

api.c: In function ‘cg_walk_node’:
api.c:2252: warning: unused variable ‘base_level’
api.c: In function ‘cgroup_walk_tree_end’:
api.c:2314: warning: unused variable ‘ret’

Fix the above warnings.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
16 years agolibcgroup: Introduce -Wall in CFLAGS
Dhaval Giani [Wed, 4 Mar 2009 11:22:07 +0000 (16:52 +0530)] 
libcgroup: Introduce -Wall in CFLAGS

We did not have -Wall in the CFLAGS and lost out on a number of warnings
because of that. Introduce it now.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agolibcgroup: Check if the data structures have been initialized for walk_tree
Dhaval Giani [Tue, 3 Mar 2009 14:51:03 +0000 (20:21 +0530)] 
libcgroup: Check if the data structures have been initialized for walk_tree

The test for cgroup_init() was not being done by the walk tree APIs.
With this it is possible for it to run without cgroup_init() being
called and having mysterious failures.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agolibcgroup: Dont check for success of moved tasks
Dhaval Giani [Tue, 3 Mar 2009 14:51:02 +0000 (20:21 +0530)] 
libcgroup: Dont check for success of moved tasks

Sometime the movement of tasks in the default cgroup can fail for
various reasons. Therefore, do not check for the success of the
movement of tasks.

Justification: These are generally for cgroups which need some special
setup, for example the RT group scheduler. This is not handled by the
library whihc is generic. If a user is intersted in these working, they
will setup a default cgroup in the config files whihc handle everything
they need.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Tested-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
16 years agoFix a compiling warning
Ken'ichi Ohmichi [Mon, 2 Mar 2009 06:43:16 +0000 (15:43 +0900)] 
Fix a compiling warning

This patch fixes the following warning of libcgroup-0.33.

$ make
flex lex.l
byacc -v -d parse.y
byacc: 2 shift/reduce conflicts
cc -g -O2 -I. -shared -fPIC -Wl,--soname,libcgroup.so.1 -o libcgroup.so \
        -Wl,--version-script,libcgroup.map,--allow-shlib-undefined \
        api.c wrapper.c lex.yy.c y.tab.c config.c
lex.l: In function 'yylex':
lex.l:30: warning: incompatible implicit declaration of built-in function 'strdup'
[snip]
$

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
16 years agoTag v0.33
Dhaval Giani [Sat, 28 Feb 2009 20:24:28 +0000 (20:24 +0000)] 
Tag v0.33

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

16 years agoFeature: Provide new libcgroup walk tree API
Dhaval Giani [Sat, 28 Feb 2009 09:27:31 +0000 (09:27 +0000)] 
Feature: Provide new libcgroup walk tree API

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

Changelog v3..v4

1. Add _end() method for the iterator

Changelog v3..v2

1. Move to iterator based design

Changelog v2..v1

1. Add base path and depth semantics for walking

This patch adds the capability to walk cgroups by providing a new API
called cgroup_walk_tree. The API accepts the controller to walk and the
order in which the directories and files must be visited. The code is
implemented as an iterator, the begin function starts the walk and
we have depth control. The next function gets the following node
and returns ECGEOF when done.

libcgroup.map has been updated to reflect the same change and the prototype
is exported in libcgroup.h.

I've also added test cases (tests/walk_test.c). Sample output is show

root is /cgroup/cpu///
path , parent , relative /, full /cgroup/cpu///
path l3, parent , relative /l3, full /cgroup/cpu///l3
path ll1, parent l3, relative /l3/ll1, full /cgroup/cpu///l3/ll1
path lll1, parent ll1, relative /l3/ll1/lll1, full /cgroup/cpu///l3/ll1/lll1
path l2, parent , relative /l2, full /cgroup/cpu///l2
path ll1, parent l2, relative /l2/ll1, full /cgroup/cpu///l2/ll1
path lll1, parent ll1, relative /l2/ll1/lll1, full /cgroup/cpu///l2/ll1/lll1
path l1, parent , relative /l1, full /cgroup/cpu///l1
path ll1, parent l1, relative /l1/ll1, full /cgroup/cpu///l1/ll1
path lll1, parent ll1, relative /l1/ll1/lll1, full /cgroup/cpu///l1/ll1/lll1
path a, parent , relative /a, full /cgroup/cpu///a
path e, parent a, relative /a/e, full /cgroup/cpu///a/e
path f, parent e, relative /a/e/f, full /cgroup/cpu///a/e/f
path f, parent a, relative /a/f, full /cgroup/cpu///a/f
path x, parent a, relative /a/x, full /cgroup/cpu///a/x
path b, parent a, relative /a/b, full /cgroup/cpu///a/b
path c, parent b, relative /a/b/c, full /cgroup/cpu///a/b/c
path d, parent c, relative /a/b/c/d, full /cgroup/cpu///a/b/c/d
path default, parent , relative /default, full /cgroup/cpu///default
root is /cgroup/cpu//a/
path , parent , relative /, full /cgroup/cpu//a/
path e, parent , relative /e, full /cgroup/cpu//a/e
path f, parent e, relative /e/f, full /cgroup/cpu//a/e/f
path f, parent , relative /f, full /cgroup/cpu//a/f
path x, parent , relative /x, full /cgroup/cpu//a/x
path b, parent , relative /b, full /cgroup/cpu//a/b
path c, parent b, relative /b/c, full /cgroup/cpu//a/b/c
Walking the first 5 nodes
root is /cgroup/cpu///
path , parent , relative /, full /cgroup/cpu///
path l3, parent , relative /l3, full /cgroup/cpu///l3
path ll1, parent l3, relative /l3/ll1, full /cgroup/cpu///l3/ll1
path lll1, parent ll1, relative /l3/ll1/lll1, full /cgroup/cpu///l3/ll1/lll1

NOTE: Parent directory is represented by an empty (not NULL) string "".
The length of the string is 0.

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

16 years agolibcgroup: Update specfile for v0.33 and bump up the version
Dhaval Giani [Fri, 27 Feb 2009 20:38:54 +0000 (20:38 +0000)] 
libcgroup: Update specfile for v0.33 and bump up the version

From: Ivana Varekova <varekova@redhat.com>

OK, here goes

This patch Originally from Ivana and with changes I've made, get the
spec file working again (rpmlint warnings need some care and
ownership).

The new version will be 0.33 and will have new man pages and newer
API and many more bug fixes

[varekova@redhat.com] Incorporate pam module instalation to the spec file -
file part change add dependency

[balbir@linux.vnet.ibm.com] Bumped up the version, getting ready for a new
release. Updated makefile to install new man pages and to move the pam
module to the correct place at the time of installation.

Signed-off-by: Ivana Varekova <varekova@redhat.com>
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@355 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup test: Change dbg to cgroup_dbg
Dhaval Giani [Fri, 27 Feb 2009 20:25:36 +0000 (20:25 +0000)] 
libcgroup test: Change dbg to cgroup_dbg

Since cgroup_dbg is defined on the basis of CGROUP_DBG, we get
libcgrouptest.h and libcg_ba.cpp to include config.h and change
dbg to cgroup_dbg.

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

16 years agolibcgroup: Add cgrulesengd man page
Dhaval Giani [Fri, 27 Feb 2009 05:43:27 +0000 (05:43 +0000)] 
libcgroup: Add cgrulesengd man page

From: Jan Safranek <jsafrane@redhat.com>

Add cgrulesengd man page and install it on 'make install'.

Rebased to lastes trunk and fixed file name.

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

16 years agobcgroup: Rename 'flash' to 'reload'
Dhaval Giani [Thu, 26 Feb 2009 11:53:08 +0000 (11:53 +0000)] 
bcgroup: Rename 'flash' to 'reload'

LSB specifies that 'reload' is the right initscript parameter to stimulate
daemon to reread its configuration file. I let the 'flash' still working, in
case somebody is used to it, but do not advertise it anywhere.

Signed-off-by: Jan Safranek <jsafrane@redhat.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@352 4f4bb910-9a46-0410-90c8-c897d4f1cd53

16 years agolibcgroup: Start cgred service after cgconfig
Dhaval Giani [Thu, 26 Feb 2009 11:50:23 +0000 (11:50 +0000)] 
libcgroup: Start cgred service after cgconfig

From: Jan Safranek <jsafrane@redhat.com>

cgred should start after cgconfig service

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

16 years agolibcgroup: Fix copyright notices
Dhaval Giani [Thu, 26 Feb 2009 11:28:48 +0000 (11:28 +0000)] 
libcgroup: Fix copyright notices

From: Jan Safranek <jsafrane@redhat.com>

Some pages have wrong year in copyright notice.

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

16 years agolibcgroup manpages: Correct project name
Dhaval Giani [Thu, 26 Feb 2009 10:20:58 +0000 (10:20 +0000)] 
libcgroup manpages: Correct project name

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

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