summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix ECGOTHER error messageIvana Varekova2009-05-081-2/+2
| | | | | | | | | | | | For now the result is eg.: Cgroup generic error, see errno: error message: No such file or directory this patch remove outdated "see errno: " part. second version Signed-off-by: Ivana Varekova <varekova@redhat.com> Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Fix of cgexec error handlingIvana Varekova2009-05-081-1/+2
| | | | | | | | | | | Fix of cgexec error handling - with this patch cgexec return the right error message - not only cg internal error value re-generated Signed-off-by: Ivana Varekova <varekova@redhat.com> Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* I tested a cgrlesengd daemon with huge load, which makes many 'su',Ken'ichi Ohmichi2009-05-082-4/+8
| | | | | | | | | | | | | | | in long time. And the daemon was killed by an OOM killer. So the daemon has memory leak. This patch fixes this problem. The daemon allocates memory at cg_prepare_cgroup(), but it does not free the memory. This patch adds necessary free() to cgroup_change_ cgroup_path by calling cgroup_free_controllers(). In addition, this patch adds free()s for handling error and flushes the counters of the allocations in cgroup_free_controllers(). Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* Changelog v2:\"Ken'ichi Ohmichi\2009-05-082-1/+105
| | | | | | | | | | | | | | | | | | | | | | | * 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>
* I have been testing a cgrulesengd daemon and I noticed it fails to\"Ken'ichi Ohmichi\2009-05-081-60/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'master' of ↵Balbir Singh2009-04-242-2/+76
|\ | | | | | | ssh://balbir_singh@libcg.git.sourceforge.net/gitroot/libcg
| * libcgroup: Correct the version to which the statistics API belongDhaval Giani2009-04-221-3/+3
| | | | | | | | | | | | | | 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>
| * libcgroup: Add new API to walk tasksDhaval Giani2009-04-222-0/+74
| | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'master' of ↵Balbir Singh2009-04-212-64/+50
|\| | | | | | | ssh://balbir_singh@libcg.git.sourceforge.net/gitroot/libcg
| * Fix a few compilation warnings in api.cBharata B Rao2009-04-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Fix the lacks of pthread_rwlock_unlock() calls.Ken'ichi Ohmichi2009-04-131-63/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Fix infinite loop if receiving a NLMSG_NOOP packet.Ken'ichi Ohmichi2009-04-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Remove autogenerated files and update documentation. More documentationBalbir Singh2009-04-014-2083/+0
|/ | | | | | updates will be needed and will be done in subsequent cleanups. Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* Here is the v2 of the patch which introduces APIs to read controllerBharata B Rao2009-04-012-0/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add free() call for error handling.Ken'ichi Ohmichi2009-03-311-2/+2
| | | | | | | | | 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>
* Add fclose() calls for error handlingKen'ichi Ohmichi2009-03-313-2/+8
| | | | | | | | | 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>
* No matter how often I test, some last-minute change screws everything up...Jan Safranek2009-03-302-2/+2
| | | | | | | | | | | | | 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>
* Rework the way how so version is definedJan Safranek2009-03-265-14/+25
| | | | | | | | | 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>
* Install cgconfigparser to /sbinJan Safranek2009-03-262-21/+53
| | | | | | | | | 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>
* Generate everythingautomakeJan Safranek2009-03-264-0/+2042
| | | | | | Finally run autoreconf -f -i to generate all the stuff that should be generated Signed-off-by: Jan Safranek <jsafrane@redhat.com>
* Fix compilation of some stuffJan Safranek2009-03-261-1/+1
| | | | | | | yacc does not generate y.tab.h, it has different name now. Signed-off-by: Jan Safranek <jsafrane@redhat.com>
* Add automake makefilesJan Safranek2009-03-264-0/+34
| | | | | | | | 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>
* Distribute files to various subdirectoriesJan Safranek2009-03-2615-0/+5476
Signed-off-by: Jan Safranek <jsafrane@redhat.com>