summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* make functions without arguments proper C99 functionsLennart Poettering2010-03-263-10/+10
| | | | | | Signed-off-by: Lennart Poettering <lennart@poettering.net> Acked-by: Dhaval Giani <dhaval.giani@gmail.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* add a couple of FIXMEs to broken codeLennart Poettering2010-03-261-0/+9
| | | | | | Signed-off-by: Lennart Poettering <lennart@poettering.net> Acked-by: Dhaval Giani <dhaval.giani@gmail.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* add const where applicable, drop const where unnecessaryLennart Poettering2010-03-267-41/+41
| | | | | | | | | | | | | | | This patch adds the const qualifier to a number of function arguments (mostly string arguments) so that client libraries can pass their own const strings to the library without having to cast their const'ness away. This also drops a couple of consts where call-by-value is done anyway, and which hence has no effect and just misleads the users and adds unnecessary noise to the signal. After all this is C, not C++. Signed-off-by: Lennart Poettering <lennart@poettering.net> Acked-by: Dhaval Giani <dhaval.giani@gmail.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* git: hide all generated files from gitLennart Poettering2010-03-247-1/+53
| | | | | | | Signed-off-by: Lennart Poettering <lennart@poettering.net> Reviewed-By: Jan Safranek <jsafrane@redhat.com> Acked-by: Dhaval Giani <dhaval.giani@gmail.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* include: refuse inclusion of seperate header filesLennart Poettering2010-03-247-2/+28
| | | | | | | | | | | Later on it might make sense to move around function definitions between header files. Hence make sure that nobody includes any header file directly except the main one. Signed-off-by: Lennart Poettering <lennart@poettering.net> Reviewed-By: Jan Safranek <jsafrane@redhat.com> Acked-by: Dhaval Giani <dhaval.giani@gmail.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* build-sys: add bootstrap.shLennart Poettering2010-03-241-0/+19
| | | | | | | | | | | Most projects carry a bootstrap.sh/autogen.sh file that calls the autotools in the right order. This bootstrap.sh also enables the default git commit hook which enforces a strict kernel-like whitespace regime. Signed-off-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* build-sys: enable silent build by defaultLennart Poettering2010-03-241-3/+6
| | | | | | | Make the automake output a bit more like the kbuild output if supported. Signed-off-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* libcgroup: Add pkg-config dataDhaval Giani2010-03-244-1/+22
| | | | | | | | | | libcgroup was not making an entry into the pkg-config database, which makes life easier when using multiple libraries. Add the needed data in order to be registered with the pkg-config database on installation. Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com> Reviewed-by: Jan Safranek <jsafrane@redhat.com> Acked-by: Lennart Poettering <lennnart@poettering.net>
* libcgroup: Version bump to v0.36.rc1Dhaval Giani2010-03-241-2/+2
| | | | | | | We are now making changes to the specfile, which needs a version bump. Bump up the version to v0.36.rc1. Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* Fix typo in wrapper.c (cgroup_get_uid_gid)Balbir Singh2010-03-241-1/+1
| | | | | | | | | Fix the typo in our cgroup_get_uid_gid routine We seem to have a typo in the function, the fix is quite obvious. Reported-by: Ciju Rajan K <ciju@linux.vnet.ibm.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* Split header file IIIJan Safranek2010-03-2112-450/+515
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changelog: - since there are no global macros, base.h is gone - since there is no base.h, all headers need to include <features.h> to get __BEGIN_DECLS - new init.h with cgroup_init() and cgroup_get_subsys_mount_point() - new error.h with error handling enum and related stuff - use #ifndef _LIBCGROUP_*_H instead _LIBCG_*_H in header guards - fix few checkpatch complaints (long lines, whitespaces, ...) The patch includes Makefile and .spec changes. I tested it compiles, make dist produces tarball with all headers, so does also the rpm. 'make' should automatically catch all changes in new headers and recompile dependent (=all) sources when any header changes. libcgroup.h - does not declare anything, it just includes all the other files. In future, it might contain base of doxygen documentation (some introduction etc.) libcgroup/error.h - the big enum with errors + error related functions libcgroup/init.h - libcgroup_init() and cgroup_get_subsys_mount_point() libcgroup/config.h - configuration reading/unloading libcgroup/groups.h - group manipulation stuff (create/modify/delete/free, incl. controllers and get/set values) + definition of struct cgroup (=must be included by libcgroup/tasks.h, which needs it) libcgroup/iterators.h - various walks, *_begin/next/end libcgroup/tasks.h - task classification, incl. rules cache manipulation In addition, I probably removed some #includes, which are not needed now when looking for the minimal #include set to build the project. I also hope I did not miss any function declaration or macro... Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* Move private definitions to private headerJan Safranek2010-03-214-19/+21
| | | | | | | | | Most of the macro definitions in licgroup.h are internal, let's move them to private header. Applications should not depend on them. The only one really needed is CG_VALUE_MAX, which is used in struct cgroup_stat. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* Anonymize error enumJan Safranek2010-03-211-1/+1
| | | | | | | | The enum with ECG* error codes should be anonymous, as pointed out by Lennart Poettering. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* Use memset to initialize sigaction structJon Bernard2010-03-121-2/+1
| | | | | | | | | | The sa_restorer field is not present on some architectures, like alpha. By using memset, the structure is initialized appropriately regardless of struct contents. Signed-off-by: Jon Bernard <jbernard@debian.org> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* rpm spec file misses the sysconfig/cgconfig fileChris2010-03-111-0/+2
| | | | | | | | | The /etc/sysconfig/cgconfig file is never installed with the current RPM spec file. This fixes it for me: Signed-off-by: Chris Tasma <chris@deksai.com> Reviewed-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* init script can miss default groupChris2010-03-111-1/+1
| | | | | | | | | | If there is a directive like *:httpd before * in the cgconfig file, all processes end up being moved into the wrong group on cgconfig startup, and the default group is never made. This fixes it for me: Signed-off-by: Chris Tasma <chris@deksai.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* Make the error stings constJan Safranek2010-03-082-3/+3
| | | | | | | Make the error stings const, just to be safe. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* Remove last_errno from public headerJan Safranek2010-03-082-5/+4
| | | | | | | Remove last_errno from public header, that's why we have cgroup_get_last_errno. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* Remove GNU_SOURCE from public headersJan Safranek2010-03-082-9/+8
| | | | | | | | Remove GNU_SOURCE from public headers, it has unpredictable consequences on applications using libcgroup.h Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* libcgroup: Add a gitignore fileDhaval Giani2010-02-171-0/+2
| | | | Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* fix cgroup_get_value_string problem with *.stat outputIvana Hutarova Varekova2010-02-102-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix cgroup_get_value_string problem with *.stat output the problem was in the low limit for value for the output of stat variables - now there are used the functions cgroup_read_stats_{begin/next/end} for this purpose bogus output: ./src/tools/cgget -r memory.stat / /: memory.stat=cache 1024561152 rss 291270656 pgpgin 1209259 pgpgout 888011 inactive_anon 8192 active_anon 2976481 fixed output: $ ./src/tools/cgget -r memory.stat / /: memory.stat=cache 1024610304 rss 291270656 pgpgin 1209271 pgpgout 888011 inactive_anon 8192 active_anon 297648128 inactive_file 619126784 active_file 399073280 unevictable 24576 hierarchical_memory_limit 9223372036854775807 hierarchical_memsw_limit 9223372036854775807 total_cache 1024610304 total_rss 291270656 total_pgpgin 1209271 total_pgpgout 888011 total_inactive_anon 8192 total_active_anon 297648128 total_inactive_file 619126784 total_active_file 399073280 total_unevictable 24576 Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* This patch adds to cgget option -a:Ivana Hutarova Varekova2010-02-102-15/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | v2: removed bunch of unnecessary error messages This patch adds to cgget option -a: -a print the variables for all controllers which consists given cgroup EXAMPLE: $ ./cgget -a /daemons /daemons: cpuset.memory_spread_slab=0 cpuset.memory_spread_page=0 cpuset.memory_pressure=0 cpuset.memory_migrate=0 cpuset.sched_relax_domain_level=-1 cpuset.sched_load_balance=1 cpuset.mem_hardwall=0 cpuset.mem_exclusive=0 cpuset.cpu_exclusive=0 cpuset.mems= cpuset.cpus= cpuacct.stat=user 0 system 0 cpuacct.usage_percpu=0 0 cpuacct.usage=0 Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* adds new option -g to cgget commandIvana Hutarova Varekova2010-02-102-43/+165
| | | | | | | | | | | | | | | | | | | adds new option -g to cgget command * the option has one argument - controller * cgget -g devices / returns the values of all variables of controller devices * the option could be used multiple times EXAMLES: $ ./cgget -n -g cpu -r cpuset.mems / cpu.rt_period_us=1000000 cpu.rt_runtime_us=950000 cpu.shares=1024 cpuset.mems=0 Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* This is the test program for listing controller variablesIvana Hutarova Varekova2010-02-102-2/+62
| | | | | | | | | | | | This is the test program for new internal functions: int cgroup_get_value_name_count(struct cgroup_controller *controller) char *cgroup_get_value_name(struct cgroup_controller *controller, int index) The program display the variables of input controllers. Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* api for generating the list of variables of given controllerIvana Hutarova Varekova2010-02-103-0/+42
| | | | | | | | | | | | | | | api for generating the list of variables of given controller: changelog - v2: fixed the space on the end of lines * int cgroup_get_value_name_count(struct cgroup_controller, *controller) functions return the number of variables in "controller" * char *cgroup_get_value_name(struct cgroup_controller *controller, int index) function return the "index" variable of "controller" Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* Release procedure proposalJan Safranek2010-02-102-17/+32
| | | | | | | | | | | | this is my proposal for release procedure - it's quite simple and covers all the technical details you need to know regarding autotools. Changelog: - re-diff with current master (and not my internal branch :) - renumber the steps Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* [PATCH-v2] Add the write error handling to cg_set_control_value().Ken'ichi Ohmichi2010-01-281-2/+9
| | | | | | | | | | | | | | Changelog since v1: o Use fopen/fprintf/fclose instead of open/write/close. o Add the error handling against fclose. cg_set_control_value() is the function for setting a value to a file of cgroup file system. And current function does not handle the error of writing to a file. So we cannot know whether setting value is enable or not. This patch add the error handling for knowing it. Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* Merge branch 'HEAD'; commit 'v0.35.1'Balbir Singh2010-01-190-0/+0
|
* Update the changelog in libcgroup.spec.inBalbir Singh2010-01-191-0/+2
| | | | Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* Fix initstripts directory.Jan Safranek2010-01-191-1/+1
| | | | | | | Put initscipts to /etc/rc.d/init.d, rpm's %{_initrddir} points there. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* Fix bad filename in MakefileJan Safranek2010-01-191-1/+1
| | | | | | | Fix bad filename in Makefile and make 'make dist' working again. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* Distribute cgget toolJan Safranek2010-01-191-0/+1
| | | | | | | Distribute cgget tool in rpms. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* v0.35Dhaval Giani2010-01-181-2/+2
| | | | Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
* Add cgget man page.Jan Safranek2010-01-183-2/+61
| | | | | Signed-off-by: Jan Safranek <jsafrane@redhat.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* libcgroup samples: Invalid namespace configurationDhaval Giani2010-01-072-0/+118
| | | | | | | | An invalide namespace configuration. This configuration is invalid because while cpu and cpuacct have been mounted at the same point, they have different namespaces. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* libcgroup samples: Valid namespace based configurationDhaval Giani2010-01-071-0/+52
| | | | | | | | Change from v2: 1. Correct the changes made in the config file format. namespace and mount not in the same file. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* libcgroup: Modify the APIs to use the namespaceDhaval Giani2010-01-071-1/+7
| | | | | | | | | | | Since every API builds its patch via build_path, updating that function should be enough. Changes from v1: 1. Append the namespace only if it is defined. This will remove an additional "/" which would be introduced otherwise. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* libcgroup: Setup the namespace datastructuresDhaval Giani2010-01-074-3/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch handles the validation of the newer configuration files. Some of the rules to be followed 1. We cannot have more controllers in the namespcae section than already mounted. 2. If more than one controller are mounted at the same point, then they will have the same namespace. In case it is not explicitly mentioned, the subsystems at the mount point will be set to the same namespace. This does not mean that controllers mounted at different points need to have the same namespace. Changes from v4: 1. Changed a variable name from mount to mount_path 2. Added more comments Changes from v3: 1. Removed most of the strdups 2. Fixed return values for errors Changes from v2: 1. mount and namespace keyword cannot come in the same file. Changes from v1: 1. Fix a bug where if a namespace was not defined, we were not exiting 2. Comment the validate namespace function 3. Make some of the variables more descriptive 4. Make namespace thread specific Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* libcgroup: Introduce the new namespace keywordDhaval Giani2010-01-074-7/+79
| | | | | | | | | | | | | | | This patch introduces a new keywork NAMESPACE which allow cgroups to be created starting from a certain point as mentioned by the administrator. This is provided via the configuration file. Newer APIs will use this feature. Changes from v1: 1. Attempted to fix the indentation 2. Change a variable name Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
* libcgroup: Remove assert in cgroup_strerror()Dhaval Giani2010-01-041-1/+1
| | | | | | | Since we add new errors after ECGSENTINEL, it makes no sense to have the assert in place. Remove the assert. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
* Merge branch 'devel/config3' of git://fedorapeople.org/~jsafrane/libcgDhaval Giani2009-12-238-106/+276
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'devel/config3' of git://fedorapeople.org/~jsafrane/libcg: Clean up the init script Use tools instead of shell scripts Make cgclear quiert when there is nothing to clear. Use cgclear on shutdown Add sample /etc/sysconfig/cgconfig Don't create sysdefault group whent it's not needed Move sysdefault handling to separate function Remove trailing space from lssubsys output Fix reading of empty parameter values Fix error text on failed reading of parameter. cgget tool
| * Clean up the init scriptdevel/config3Jan Safranek2009-12-221-18/+0
| | | | | | | | | | | | Some parts of the init script are not needed with the recent changes. Signed-off-by: Jan Safranek <jsafrane@redhat.com>
| * Use tools instead of shell scriptsJan Safranek2009-12-221-28/+27
| | | | | | | | | | | | | | | | libcgroup now provides some tools, which can be used in the init script instead of bash code. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
| * Make cgclear quiert when there is nothing to clear.Jan Safranek2009-12-221-0/+3
| | | | | | | | | | | | | | Cgclear clears and unmounts all controllers. Therefore I think it's not an error when there is nothing to clear and unmount. Signed-off-by: Jan Safranek <jsafrane@redhat.com>
| * Use cgclear on shutdownJan Safranek2009-12-221-39/+1
| | | | | | | | | | | | | | | | Use cgclear on service cgconfig stop, it's much faster than manual group removal. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
| * Add sample /etc/sysconfig/cgconfigJan Safranek2009-12-222-1/+13
| | | | | | | | | | | | | | | | | | | | Feel free to rephrase it's content, I could not find any better words to describe sysdefault group usability. Changelog: - set the default to 'yes' Signed-off-by: Jan Safranek <jsafrane@redhat.com>
| * Don't create sysdefault group whent it's not neededJan Safranek2009-12-221-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IMHO most of users don't need sysdefault group being created during boot - it's quite slow and at least in Fedora there is no application using it. So, let users to configure it and allow them to turn the sysdefault off. Whether the option should be enabled/disabled is distro-specific, we as libcgroup turn it on. Changelog: - create the sysdefault group by default Signed-off-by: Jan Safranek <jsafrane@redhat.com>
| * Move sysdefault handling to separate functionJan Safranek2009-12-221-20/+24
| | | | | | | | | | | | | | Move sysdefault handling to separate function - it simplifies following patch. Signed-off-by: Jan Safranek <jsafrane@redhat.com>
| * Remove trailing space from lssubsys outputJan Safranek2009-12-221-2/+2
| | | | | | | | | | | | | | Remove trailing space from lssubsys output, it can confuse scripts. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
| * Fix reading of empty parameter valuesJan Safranek2009-12-221-3/+7
| | | | | | | | | | | | | | | | | | | | | | When a group parameter has empty value (like uninitialized cpuset.cpus), libcgroup does not return this parameter value - it returns ECGROUPVALUENOTEXIST instead. I think reading whole parameter file instead of just '%s' is the right thing to do - it helps also with multiline values, like cpuacct.stat. Signed-off-by: Jan Safranek <jsafrane@redhat.com>