summaryrefslogtreecommitdiffstats
path: root/src/parse.y
Commit message (Collapse)AuthorAgeFilesLines
* Fix a memory leak in "cgconfig" service.Ken'ichi Ohmichi2009-12-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi, When I operated "cgconfig" service on valgrind, I found a memory leak like the following: # cat /etc/cgconfig.conf mount { cpuset = /cgroup/cpuset; cpu = /cgroup/cpu; memory = /cgroup/memory; } group user000 { cpuset { cpuset.cpus = 0; cpuset.mems = 0; } } group user000/sleep000 { cpuset { cpuset.cpus = 0; cpuset.mems = 0; } } # valgrind --tool=memcheck --leak-check=yes cgconfigparser -l /etc/cgconfig.conf ==13095== Memcheck, a memory error detector. ==13095== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al. ==13095== Using LibVEX rev 1658, a library for dynamic binary translation. ==13095== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP. ==13095== Using valgrind-3.2.1, a dynamic binary instrumentation framework. ==13095== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al. ==13095== For more details, rerun with: -v ==13095== ==13095== ==13095== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 1) ==13095== malloc/free: in use at exit: 43,062 bytes in 10 blocks. ==13095== malloc/free: 129 allocs, 119 frees, 85,399 bytes allocated. ==13095== For counts of detected errors, rerun with: -v ==13095== searching for pointers to 10 not-freed blocks. ==13095== checked 6,795,480 bytes. ==13095== ==13095== 28 bytes in 2 blocks are definitely lost in loss record 1 of 5 ==13095== at 0x4A0590B: realloc (vg_replace_malloc.c:306) ==13095== by 0x4C0CC24: yyparse (parse.y:117) ==13095== by 0x4C12914: cgroup_config_load_config (config.c:467) ==13095== by 0x4008A2: main (cgconfig.c:60) ==13095== ==13095== LEAK SUMMARY: ==13095== definitely lost: 28 bytes in 2 blocks. ==13095== possibly lost: 0 bytes in 0 blocks. ==13095== still reachable: 43,034 bytes in 8 blocks. ==13095== suppressed: 0 bytes in 0 blocks. ==13095== Reachable blocks (those to which a pointer was found) are not shown. ==13095== To see them, rerun with: --show-reachable=yes # This patch fixes the memory leak. Thanks Ken'ichi Ohmichi 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>
* Fix a cgconfig behavior of wrong /etc/cgconfig.conf.Ken'ichi Ohmichi2009-11-111-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changelog since v2: o Avoid breaking ABI by changing the ECGCONFIGPARSEFAIL value. Changelog since v1: o Change a parser error value of /etc/cgconfig.conf to ECGCONFIGPARSEFAIL. The cgconfig service succeeds even if there are something wrong in /etc/cgconfig.conf. For example, it succeeds even if specifying not-existing user (nouser) as a perm.task.uid like the following: # cat /etc/cgconfig.conf mount { cpuset = /mnt/cgroups/cpuset; memory = /mnt/cgroups/memory; } group root { perm { task { uid = nouser; gid = root; } admin { uid = root; gid = root; } } cpuset { cpuset.cpus = 0; cpuset.mems = 0; } memory { memory.use_hierarchy = 1; memory.limit_in_bytes = 1000000000000; } } # # service cgconfig start Starting cgconfig service: parsing failed at line number 10 [ OK ] # echo $? 0 # That is not a good behavior and the cgconfig service should fail if there are something wrong in /etc/cgconfig.conf. This patch fixes the behavior. In the above case, the behavior is changed like the following by this patch: # service cgconfig start Starting cgconfig service: parsing failed at line number 10 Loading configuration file /etc/cgconfig.conf failed Cgroup parsing failed Failed to parse /etc/cgconfig.conf [FAILED] # Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Distribute files to various subdirectoriesJan Safranek2009-03-261-0/+269
Signed-off-by: Jan Safranek <jsafrane@redhat.com>