]> git.ipfire.org Git - thirdparty/libcgroup.git/log
thirdparty/libcgroup.git
12 years agoAdded parsing of CGROUP_LOGLEVEL
Peter Schiffer [Tue, 2 Apr 2013 08:55:33 +0000 (10:55 +0200)] 
Added parsing of CGROUP_LOGLEVEL

Allowed values are:
 - DEBUG, INFO, WARNING, ERROR (case insensitive)
 - integer numbers

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoReworked logging configuration
Peter Schiffer [Tue, 2 Apr 2013 08:54:58 +0000 (10:54 +0200)] 
Reworked logging configuration

Debug log messages are now automatically compiled in libcgroup unless
explicitly disabled with ./configure --disable-debug.

Please note that the messages still must be enabled in runtime by setting
appropriate log level, e.g. export CGROUP_LOGLEVEL=DEBUG.

Changelog:
  - removed --disable-debug option of configure script, removing debug
    messages we would save 'amazing' 4kB, which is IMO not worth it.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoEnabled default logging
Peter Schiffer [Tue, 2 Apr 2013 08:54:24 +0000 (10:54 +0200)] 
Enabled default logging

Default target of log messages is stdout and ERRORs are sent there by
default.

This is quite a change from the behavior of previous versions - no logging
was sent anywhere unless --enable-debug was specified at ./configure time.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoReworked libcgroup logging
Peter Schiffer [Tue, 2 Apr 2013 08:52:59 +0000 (10:52 +0200)] 
Reworked libcgroup logging

Whole new logging with following goals is here:
 - more log levels.
 - allow applications to log somewhere else than stdout using their custom
   callback.
 - provide simple stdout logger for 'lazy' applications.

The logging is off by default, i.e. no message appears on stdout unless
application initializes the logging explicitly. But see following patches!

Internally, nothing changes, cgroup_dbg is still working. In addition,
cgroup_err, cgroup_warn and cgroup_info appeared. Description what message
should use which log level is in doxygen info, together with new public API
incl. simple example, I won't copy it here

Also the cgroup_log function is made public. I am not sure if it is the
right thing to do, but that's currently the simplest way how to use the
logging from our tools (which link only the public libcgroup API).

Changelog:
  - fixed typo in cgroup_log doxygen comment

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoRemoved cgroup_dbg from cgrulesengd
Peter Schiffer [Tue, 2 Apr 2013 08:52:35 +0000 (10:52 +0200)] 
Removed cgroup_dbg from cgrulesengd

Changelog:
  - changed severity of few log messages as pointed by Ivana

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agolibcg: scan running tasks at start time to classify existing pids
John Fastabend [Wed, 20 Feb 2013 17:08:19 +0000 (09:08 -0800)] 
libcg: scan running tasks at start time to classify existing pids

Add routine to scan rules.conf file and move matching running tasks
in /proc/pid/* into configured control groups. Then at init time
we can move running tasks into the correct control group.

Expose this routine via libcg so other applications can use it
to classify existing applications after creating control groups.

CC: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
12 years agoupdate documentation to reflect the changes regarding templates
Ivana Hutarova Varekova [Mon, 28 Jan 2013 13:45:55 +0000 (14:45 +0100)] 
update documentation to reflect the changes regarding templates

    cgrules.conf(5): add information about templates setting in rules
    cgconfig.conf(5): add information about templates setting + example
    cgrulesengd(8): add information about SIGUSR1 signal which call reloads
the templates configuration
    README_daemon: the same change as in cgrulesengd(8)

    CHANGELOG:
    * cgrules.conf - incorporate Jan's feedback

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek<jsafrane@redhat.com>
12 years ago cgroup_change_cgroup_flags: use templates if they are in rules
Ivana Hutarova Varekova [Mon, 28 Jan 2013 13:44:53 +0000 (14:44 +0100)] 
cgroup_change_cgroup_flags: use templates if they are in rules

    cgroup_change_cgroup_flags:
    use cgroup_config_create_template_group instead of cgroup_create_cgroup
    -> this function reads configure file, if it is not already cached and
    use template setting from if the template is used in rule and the group
    does not exist yet.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek<jsafrane@redhat.com>
12 years ago cgrulesengd: cache templates
Ivana Hutarova Varekova [Mon, 28 Jan 2013 13:44:24 +0000 (14:44 +0100)] 
cgrulesengd: cache templates

    This patch adds templates caching to cgrulesengd
     * they are initialized
     * reloaded in case of signal SIGUSR1

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek<jsafrane@redhat.com>
12 years ago api: add function for creating template control groups
Ivana Hutarova Varekova [Mon, 28 Jan 2013 13:42:25 +0000 (14:42 +0100)] 
api: add function for creating template control groups

    add a function: int cgroup_config_create_template_group(const char *pathname,
                struct cgroup *cgroup, char *template_name,
                int ignore_ownership);

     Physically create a new control group in kernel, based on given control
     group template and configuration file. If given template is not set in
     configuration file, then the procedure works create the control group
     using  cgroup_create_cgroup function

    input parameters are:
    pathname .. name of template configuration file (/etc/cgconfig.conf by default)
    cgroup   .. control group name and subsystems to which it should belong to
    template_name .. name of the template we want to use
    flags .. Bit flags to change the behavior

    return 0 on success

    CHANGELOG:
        reload template rules if it is necessary, don't init them
        create a control group in all controllers which have no relevant template
        return the template name when it is changed - Jan's feedback

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek<jsafrane@redhat.com>
12 years agoconfig.h: create function for init/reload cgconfig template cache
Ivana Hutarova Varekova [Mon, 28 Jan 2013 13:41:38 +0000 (14:41 +0100)] 
config.h: create function for init/reload cgconfig template cache

    Two new functions maintain the templates cache:
    int cgroup_init_templates_cache(char *pathname);
    int cgroup_reload_cached_templates(char *pathname);

    their are analogous to cgroup_init_rules_cache and cgroup_reload_cached_rules
    the only difference is there can be set configuration file as a parameter

    Changelog: remove useless comments

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
12 years agocgconfig.conf: parse template tag and fill relevant structures
Ivana Hutarova Varekova [Mon, 28 Jan 2013 13:41:32 +0000 (14:41 +0100)] 
cgconfig.conf: parse template tag and fill relevant structures

    cgconfig.conf: this patch add structures : MAX_TEMPLATES, config_template_table, config_template_table_index and the body of functions: template_config_insert_cgroup, template_config_parse_controller_options
    The structures stored the content of "template" tag from configuration file "cgconfig.conf". The structure have the same meaning as have structures for control groups tag.

    CHANGELOG:
        create enum instead of constants

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
12 years agocgconfigparser: add template tag to cgconfigparser
Ivana Hutarova Varekova [Mon, 28 Jan 2013 13:38:16 +0000 (14:38 +0100)] 
cgconfigparser: add template tag to cgconfigparser

    Template cgroups mean control groups which are set in cgrules.conf file and the name contains % variable like %U (see cgrules.conf manual page for the whole list of variables).

    This patch tunes cgconfigparser to accept template tag. With this patch the tag is accepted and ignored. The next patch will parse it and do relevant work.

    Example:
        template student/%u {
            cpu {
                    cpu.shares = "1000";
            }
        }

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
12 years agocgroup_change_cgroup_flags: create template control group on the fly
Ivana Hutarova Varekova [Mon, 28 Jan 2013 13:31:43 +0000 (14:31 +0100)] 
cgroup_change_cgroup_flags: create template control group on the fly

    Template cgroups mean control groups which are set in cgrules.conf file and the name contains % variable like %U (see cgrules.conf manual page for the whole list of variables).

    This patch change cgroup_change_cgroup_flags function. Now if the wanted group is template group and the group does not exist then cgroup_change_cgroup_flags create the control group on the fly .

    For now the created group can't be set - there is always used function cgroup_create_cgroup. This will be changed in other patch in this patchset.

    EXAMPLE:
    e.g.
        @students   devices         people/students/%U
        cgroup_change_cgroup_flags will create a cgroup /people/students/john if user john from group students run a command and the people does not exist yet.
        if /people/students group does not exist it will be created as well

    CHANGELOG:
        backslash -> slash
        cgroup_copy_with_backslash: fix the index of final '/' character
        add last_errno setting
        fix comments
    CHANGELOGv2:
        incorporate dhaval's feedback:
        in cgroup_exist_in_subsystem add ret variable and handle it properly
        make cgroup_create_template_group static
        free template name if group_name can't be set
        return '/' sign if there is a problem in cgroup_create_template_group while cycle
        add new procedure not to have cgroup_create_template_group too large

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek<jsafrane@redhat.com>
12 years agofix defaultcgroup detection (better description)
Robert Milasan [Thu, 22 Nov 2012 16:47:47 +0000 (17:47 +0100)] 
fix defaultcgroup detection (better description)

b55ce704 (scripts: cgconfig, cleanup) introduced a regression because
read is now executed in a subshell so the variables are not visible
in the outer context and so defaultcgtoup is never non-empty.

Fix the issue by using here text which doesn't involve subshell.

Signed-off-by: Robert Milasan <rmilasan@suse.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
12 years agocgrules.conf: no documentation inside config file
Ivana Hutarova Varekova [Mon, 24 Sep 2012 06:59:53 +0000 (08:59 +0200)] 
cgrules.conf: no documentation inside config file

cgrules.conf: don't put incomplete documentation inside the config
file. (There is missing the description of expandable strings in destination
column.) The link to manual page is better.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
12 years agocgconfigparser: fix error message
Ivana Hutarova Varekova [Mon, 24 Sep 2012 06:59:38 +0000 (08:59 +0200)] 
cgconfigparser: fix error message

cgconfigparser missing \n character at the end of error output

before:
[root@dhcp-26-101 ~]# cgconfigparser
cgconfigparser wrong mode format /etc/cgconfig.conf[root@dhcp-26-101
~]#

after:
[root@dhcp-26-101 ~]# cgconfigparser
cgconfigparser wrong mode format /etc/cgconfig.conf
[root@dhcp-26-101 ~]

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
13 years agov0.39.rc1
Dhaval Giani [Thu, 2 Aug 2012 14:57:23 +0000 (10:57 -0400)] 
v0.39.rc1

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agolibcgroup: Add a cgroup element to point to the owner in the controller
Dhaval Giani [Fri, 29 Jun 2012 09:37:39 +0000 (15:07 +0530)] 
libcgroup: Add a cgroup element to point to the owner in the controller

Since the only way to create a controller is from the wrapper API, it is
always linked to one cgroup. Since it would help knowing which cgroup a
controller belongs to, let's just add that information in there.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Cc: Glauber Costa <glommer@parallels.com>
13 years agowrappers: Add a cgroup_get_cgroup_name API
Dhaval Giani [Fri, 29 Jun 2012 09:37:38 +0000 (15:07 +0530)] 
wrappers: Add a cgroup_get_cgroup_name API

We had no way of getting the name from the cgroup structure. We
have enough users who do want this information. Provide an API
to do so.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Cc: Glauber Costa <glommer@parallels.com>
13 years agoFix cgroup_modify_cgroup gratuitous failure
Glauber Costa [Fri, 27 Jul 2012 10:55:55 +0000 (12:55 +0200)] 
Fix cgroup_modify_cgroup gratuitous failure

Around one year ago, the following was reported:
http://comments.gmane.org/gmane.comp.lib.libcg.devel/3116 (Error when
calling cgroup_modify_cgroup())

I ran into the very same error. Inspecting the code in libcg, it seemed
to me that the best thing to avoid that is to never attempt to write
something the user never wrote to.

That is because if the user actually tries to write to a read-only file,
we should yield an error, making skipping read-only a bad solution.

My solution is to add a field to the value structure indicating whether
or not it is dirty. That value will indicate whether or not an error in
the write-to-filesystem routine is considered fatal or not.  Non-dirty
values will still be written, but their failures are not considered
fatal. cgroup_modify_cgroup then becomes a simple flusher, and the
problem goes away.

[ v2: Also mark dirty value writes using cgroup_set_value_* ]
[ v3: fail if write fails only for dirty values ]

Signed-off-by: Glauber Costa <glommer@parallels.com>
13 years agocgset: more verbose -h output
Ivana Hutarova Varekova [Wed, 18 Jul 2012 19:03:04 +0000 (21:03 +0200)] 
cgset: more verbose -h output

create more verbose -h output similar as the other libcgroup tools fix man page typo

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgexec: more verbose help
Ivana Hutarova Varekova [Wed, 18 Jul 2012 19:02:45 +0000 (21:02 +0200)] 
cgexec: more verbose help

cgexec: create more verbose -h output similar as the other libcgroup tools

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgclassify: improve help output
Ivana Hutarova Varekova [Wed, 18 Jul 2012 19:02:31 +0000 (21:02 +0200)] 
cgclassify: improve help output

cgclassify: do more verbose help output, accept --help option

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgclear: fix -h option parsing/output
Ivana Hutarova Varekova [Wed, 18 Jul 2012 18:53:38 +0000 (20:53 +0200)] 
cgclear: fix -h option parsing/output

add -h to parsed options
create more verbose -h output

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agounify libcgroup tools -h output
Ivana Hutarova Varekova [Wed, 18 Jul 2012 18:53:09 +0000 (20:53 +0200)] 
unify libcgroup tools -h output

unify libcgroup tools -h output

use <controllers>:<path> as a parameter of -g
        * cgclassify
        * cgget

fix typos
        * cgget
        * cgset

fix indentation
        * cgconfig
        * cgsnapshot

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agoupdate TODO lists
Ivana Hutarova Varekova [Mon, 16 Jul 2012 12:58:36 +0000 (14:58 +0200)] 
update TODO lists

remove done tasks from config.c and api.c TODO list

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgsnapshot: add the end of string character when it is necessary
Ivana Hutarova Varekova [Mon, 16 Jul 2012 12:54:19 +0000 (14:54 +0200)] 
cgsnapshot: add the end of string character when it is necessary

add the end of string character when it is necessary

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
13 years agoapi.c: fix typo in error code description
Ivana Hutarova Varekova [Mon, 16 Jul 2012 12:46:55 +0000 (14:46 +0200)] 
api.c: fix typo in error code description

fix minor typo in error code description

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
13 years agoerror.h: fix numbering of error codes
Glauber Costa [Mon, 25 Jun 2012 11:29:00 +0000 (13:29 +0200)] 
error.h: fix numbering of error codes

fix numbering of error codes from ECGEOF error code.

Signed-off-by: Glauber Costa <glommer@parallels.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agolscgroup: don't trim "/"
Ivana Hutarova Varekova [Fri, 22 Jun 2012 19:13:56 +0000 (21:13 +0200)] 
lscgroup: don't trim "/"

The present version of lscgroup trimmed "/" signs from the end of output
path.
    The functionality was necessary because of cg_build_path function add
useless "/" characters to the patch. This is fixed by the previous api
patch.
    Moreover other unix commands (du, grep) leave the format of path as it
was added in input (with all typed "/" characters). Thus lscgroup should
not remove "/" which were added in command line.

    Example
    old version:
    $ lscgroup memory://abc///
    memory:/abc///
    memory:/abc///gh
    memory:/abc///def
    $ lscgroup
    cpuset:/
    cpuset:/3

    new version:
    $ lscgroup memory://abc///
    memory://abc///
    memory://abc///gh
    memory://abc///def
    $ lscgroup
    cpuset:/
    cpuset:/3

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocg_build_path adds needless "/" character
Ivana Hutarova Varekova [Fri, 22 Jun 2012 13:38:34 +0000 (15:38 +0200)] 
cg_build_path adds needless "/" character

    cg_build_path adds needless "/" character in cases when the input path
    ends/starts with character "/" itself. This character is added now only
in cases it is wanted and it was not set.

    Changelog
    - incorporate Jan's feedback - fix typo in patch description, use snprintf instead of sprintf
    - deal with the situation if directory name is empty as well
    - move the path concatenation functionality to a separate function

    Example:
    Old version:
    cg_build_path("", path, memory);
    returns /sys/fs/cgroup/memory//
    cg_build_path("/3", path, memory);
    returns /sys/fs/cgroup/memory//3/
    cg_build_path("3/", path, memory);
    returns /sys/fs/cgroup/memory/3//

    New version:
    cg_build_path("", path, memory);
    returns /sys/fs/cgroup/memory/
    cg_build_path("/3", path, memory);
    returns /sys/fs/cgroup/memory/3/
    cg_build_path("3/", path, memory);
    returns /sys/fs/cgroup/memory/3/

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agoman pages typos
Ivana Hutarova Varekova [Fri, 22 Jun 2012 08:36:13 +0000 (10:36 +0200)] 
man pages typos

    This patch fix typos in manual pages (cgclassify.1, cgconfig.conf.5, cgget.1, cgset.1, lscgroup.1)

    Changelog:
    cgget.1 - incorporate dhaval's feedback which -> whose

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years ago testsuite: fix cgclear call in testenv.sh II
Ivana Hutarova Varekova [Sat, 19 May 2012 19:34:01 +0000 (21:34 +0200)] 
testsuite: fix cgclear call in testenv.sh II

    This patch fixes cgclear call in testenv.sh
    In the previous version there is missing the patch.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agotestsuite: runlibcgrouptest have to be configurable
Ivana Hutarova Varekova [Fri, 18 May 2012 16:18:36 +0000 (18:18 +0200)] 
testsuite: runlibcgrouptest have to be configurable

runlibcgrouptest have to set the path to config.h properly thus it have
to be configurable

CHANGELOG v1:
* remove obsolete TODO comment
* add runlibcgrouptest.sh to configure.in

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
13 years agotestsuite: wrong cgroup mount points parsing
Ivana Hutarova Varekova [Fri, 18 May 2012 15:59:01 +0000 (17:59 +0200)] 
testsuite: wrong cgroup mount points parsing

testsuite: runlibcgrouptest.sh has too benevolent mount points parsing
thus there are filtred other mount points (not only cgroup one) as well.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
13 years agotestsuite: incorporate OPAQUE_HIERARCHY
Ivana Hutarova Varekova [Fri, 18 May 2012 15:49:06 +0000 (17:49 +0200)] 
testsuite: incorporate OPAQUE_HIERARCHY

In present version of testsuite OPAQUE_HIERARCHY variable is ignored,
thus testsuite is broken in systems where OPAQUE_HIERARCHY is nonempty. The patch fix this problem.

CHANGELOG v1:
* use ^cgroup instead of cgroup in grep (otherwise it counts also tmpfs /sys/fs/cgroup)
* remove obsolete IS_OPAQUE variable

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
13 years agocgcreate.1: -s option problem
Ivana Hutarova Varekova [Sat, 12 May 2012 16:21:10 +0000 (18:21 +0200)] 
cgcreate.1: -s option problem

cgcreate.1 man page have bogus -s description this patch fixes it

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
13 years agoFrom: Ivana Hutarova Varekova <varekova@redhat.com>
Ivana Hutarova Varekova [Thu, 10 May 2012 05:07:41 +0000 (07:07 +0200)] 
From: Ivana Hutarova Varekova <varekova@redhat.com>

lscgroup: fix path name trimming

lscgroup tool in display_controller_data procedure trimmed relative path
name too strictly, thus if the path have no leading "/" sign then the first
character was trimmed too.

More precisely the relative path is taken from the full path - path to the
controller root and relative path given on command line (with all
characters "/") + character "/" at the end of path. The length of suffix
which describe relative path is count from trimmed relative path given on
command line (without characters "/" at the beginning and at the end).
There have to be used the same relative path in both cases and -1 to the
length.

CHANGELOG v1:
* more detailed description
* fix the problem with "/" sign at the end of path too

EXAMPLE
without the patch:
$ lscgroup freezer:libvirt
freezer:/ibvirt/
freezer:/ibvirt/lxc
freezer:/ibvirt/qemu

with the patch:
$ lscgroup freezer:libvirt
freezer:/libvirt/
freezer:/libvirt/lxc
freezer:/libvirt/qemu

this patch fixes the problem.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek<jsafrane@redhat.com>
13 years agocgcreate: --help patch
Ivana Hutarova Varekova [Tue, 8 May 2012 16:56:35 +0000 (18:56 +0200)] 
cgcreate: --help patch

this patch adds missing "," character to --help output

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocgclear: missing indentation in -h output
Ivana Hutarova Varekova [Tue, 8 May 2012 16:26:53 +0000 (18:26 +0200)] 
cgclear: missing indentation in -h output

added missing indentation to -h output of cgclear tool

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agoRemove unused error code ECGSENTINEL - it was used for test whether error
Ivana Hutarova Varekova [Sun, 6 May 2012 10:59:50 +0000 (12:59 +0200)] 
Remove unused error code ECGSENTINEL - it was used for test whether error
code is in valid interval, now it is unused.

Changelog:
* let the next error have the same number as before the change, not to
break ABI

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agoRemoved unused variable ‘cgroup_dir_path’ in lscgroup
Ivana Hutarova Varekova [Fri, 4 May 2012 05:20:19 +0000 (07:20 +0200)] 
Removed  unused variable â€˜cgroup_dir_path’ in lscgroup
in function â€˜display_controller_data’.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
Reviewed-by: Balbir Singh <bsingharora@gmail.com>
13 years agoapi.c: remove obsolete error message
Ivana Hutarova Varekova [Wed, 2 May 2012 17:57:34 +0000 (19:57 +0200)] 
api.c: remove obsolete error message

Remove forgotten error message which break error code <-> message
mapping

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agotestsuite: fix cgclear call in testenv.sh
Ivana Hutarova Varekova [Wed, 2 May 2012 17:49:46 +0000 (19:49 +0200)] 
testsuite: fix cgclear call in testenv.sh

This patch fixes cgclear call in testenv.sh

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agotestsuite: fix wrong lssubsys call
Ivana Hutarova Varekova [Wed, 2 May 2012 17:41:04 +0000 (19:41 +0200)] 
testsuite: fix wrong lssubsys call

cgconfigparser_simple tool call lssubsys command without TOOLSDIR prefix

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agolscgroup: removed unused variable
Ivana Hutarova Varekova [Wed, 2 May 2012 17:19:50 +0000 (19:19 +0200)] 
lscgroup: removed unused variable

Removed  unused variable â€˜cgroup_dir_path’ in lscgroup
in function â€˜display_controller_data’.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agov0.38.rc1 release
Jan Safranek [Fri, 3 Feb 2012 15:56:44 +0000 (16:56 +0100)] 
v0.38.rc1 release

13 years agoUpdated release process documentation.
Jan Safranek [Fri, 3 Feb 2012 15:48:38 +0000 (16:48 +0100)] 
Updated release process documentation.

Added a note about git shortlog, I keep forgetting the command.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agoAdd README_systemd to release
Jan Safranek [Fri, 3 Feb 2012 15:02:26 +0000 (16:02 +0100)] 
Add README_systemd to release

README_systemd should be part of libcgroup-0.38.tar.bz2 release.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agotests: added missing files to Makefile.am
Jan Safranek [Fri, 3 Feb 2012 14:03:54 +0000 (15:03 +0100)] 
tests: added missing files to Makefile.am

Some files were missing in our Makefiles and 'make dist'
did not include them in released .tar.bz2.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Fixed cgroup_strerror() typo.
Jan Safranek [Thu, 15 Dec 2011 14:45:47 +0000 (15:45 +0100)] 
libcgroup: Fixed cgroup_strerror() typo.

Adding missing comma to list of error messages.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agoLibcgroup: added cgconfig.service unit for systemd.
Jan Safranek [Thu, 15 Dec 2011 13:55:51 +0000 (14:55 +0100)] 
Libcgroup: added cgconfig.service unit for systemd.

The cgconfig.service unit file should create all groups in
/etc/cgconfig.conf and (if not overriden in the config file) with sticky
bit on their tasks file. On service stop, only control groups specified in the
config file are cleared and only if they are empty (i.e. no subgroups and no
processes inside).

Please review carefully, especially the ordering. I want the service to
start as early as possible, but not before local filesystem is ready.

Changelog:
 - updated After/Before dependencies

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Added README_systemd file.
Jan Safranek [Thu, 15 Dec 2011 13:55:43 +0000 (14:55 +0100)] 
libcgroup: Added README_systemd file.

New documentation file is added. It should describe how systemd and
libcgroup should work together and how to configure a system to have
control groups created by libcgroup's cgconfig service.

I'm going to install this README into /usr/share/doc/libcgroup-*/.

I know I am not Shakespeare and also English is not my mother language, feel
free to comment also the style and grammar. Missing/wrong articles is my
speciality :).

Changelog:
  - updated with review remarks from Martin Prpic and Kevin Constantine

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Added compile-time option to ignore certain hierarchies (e.g. systemd).
Jan Safranek [Fri, 9 Dec 2011 14:05:02 +0000 (15:05 +0100)] 
libcgroup: Added compile-time option to ignore certain hierarchies (e.g. systemd).

Libcgroup should not mess up with systemd 'name=systemd' hierarchy. Let's
add ./configure option to ignore it on distros, which use it.

Only one hierarchy can be ignored, at least at this time, further
enhancement is possible.

Usage:
$ configure --enable-opaque-hierarchy="name=systemd"

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgconfigparser: Added 'default' section documentation to cgconfig.conf man.
Jan Safranek [Fri, 9 Dec 2011 14:04:48 +0000 (15:04 +0100)] 
cgconfigparser: Added 'default' section documentation to cgconfig.conf man.

Add documentation of the new section to cgconfig.conf(5).

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgcreate, cgconfigparser: Fixed help and documentation style.
Jan Safranek [Fri, 9 Dec 2011 14:04:41 +0000 (15:04 +0100)] 
cgcreate, cgconfigparser: Fixed help and documentation style.

Rephrase the documentation to common style and fix minor typos.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgcreate, cgconfigparser: Added new parameter for tasks file permissions.
Jan Safranek [Fri, 9 Dec 2011 14:04:33 +0000 (15:04 +0100)] 
cgcreate, cgconfigparser: Added new parameter for tasks file permissions.

So far cgcreate and cgconfigparser have -f option, which sets permissions
of all files in a group, incl. tasks file. Since we need to put sticky bit
on the tasks file for systemd, this patch adds -s option for this purpose.

The tests are also updated with this change.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgcreate, cgconfigparser: Fixed permissions when only one of '-f' and '-d' is set.
Jan Safranek [Fri, 9 Dec 2011 14:04:24 +0000 (15:04 +0100)] 
cgcreate, cgconfigparser: Fixed permissions when only one of '-f' and '-d' is set.

When only one of '-f' and '-d' is set, the other is set automatically to
zero and nobody then has the rights to read/modify a group or group's
parameters.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agotests: Fixed tests for cgclear -e
Jan Safranek [Fri, 9 Dec 2011 14:04:17 +0000 (15:04 +0100)] 
tests: Fixed tests for cgclear -e

Previous patch fixed exit code of cgclear -e, but I forgot to update the
tests. Here is a fix.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgclear: fixed exit code with -e option
Jan Safranek [Tue, 6 Dec 2011 15:06:58 +0000 (16:06 +0100)] 
cgclear: fixed exit code with -e option

cgclear -e is supposed to clear only empty groups. This works fine, but
when a non-empty group is being cleared, cgclear displays an error and
returns nozero exit code.

It should be silent and return zero exit code, because stumbling upon a
nonempty group is perfectly fine and not an error.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: added new error code when removing non-empty group.
Jan Safranek [Tue, 6 Dec 2011 15:06:50 +0000 (16:06 +0100)] 
libcgroup: added new error code when removing non-empty group.

ECGNONEMPTY error code is returned by cgroup_delete_cgroup_ext when it
should remove only empty groups, but the group(s) were not empty.

It's not a real error, it's just an indication that some groups were not
removed - it's perfectly valid use case.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agoscripts: cgconfig, wait for ypbind
Jiri Slaby [Wed, 23 Nov 2011 15:35:42 +0000 (16:35 +0100)] 
scripts: cgconfig, wait for ypbind

This is to allow username from an NIS service to work with cgconfig
properly.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
13 years agotests: Added tests for cgconfigparser witg -f, -d, -a and -t options.
Jan Safranek [Wed, 30 Nov 2011 14:42:58 +0000 (15:42 +0100)] 
tests: Added tests for cgconfigparser witg -f, -d, -a and -t options.

Added new tests to check cgconfigparser with the new options.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agotools: Fixed parsing of SUID/SGID/sticky bits in -t and -a options.
Jan Safranek [Wed, 30 Nov 2011 14:42:50 +0000 (15:42 +0100)] 
tools: Fixed parsing of SUID/SGID/sticky bits in -t and -a options.

Add support of 4-character octal numbers in parse_mode().

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgconfigparser: Added options to set default owners/permissions.
Jan Safranek [Wed, 30 Nov 2011 14:42:43 +0000 (15:42 +0100)] 
cgconfigparser: Added options to set default owners/permissions.

Based on cgcreate arguments, cgconfigparser now has command line arguments
to set default permissions of groups and files created by it.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Added cgroup_config_set_default() function.
Jan Safranek [Wed, 30 Nov 2011 14:42:36 +0000 (15:42 +0100)] 
libcgroup: Added cgroup_config_set_default() function.

With cgroup_config_set_default() can an application set default permissions
of groups and files created by cgroup_config_load_config(). See the
documentation of the function.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agotools: Added parse_mode() and parse_uid_gid() to tools_common.c.
Jan Safranek [Wed, 30 Nov 2011 14:42:29 +0000 (15:42 +0100)] 
tools: Added parse_mode() and parse_uid_gid() to tools_common.c.

The parse_mode() function will be used by cgconfigparser, so move it there.
In addition, the cgconfigparser will need uid:gid parsing routines from
cgcreate.c, so move it to common code as well.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agotests: Added tests for default permissions.
Jan Safranek [Wed, 30 Nov 2011 14:42:22 +0000 (15:42 +0100)] 
tests: Added tests for default permissions.

Here are few tests for config file with default permissions, including
setting SUID, SGID and sticky bits to files/directories.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agotests: Added checks for UID and GID in permission test.
Jan Safranek [Wed, 30 Nov 2011 14:42:15 +0000 (15:42 +0100)] 
tests: Added checks for UID and GID in permission test.

We should check also if cgconfigparser sets correct UID/GID on
files/directories it creates.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgconfigparser: Allow SUID and SGID permissions in 'fperm' and 'dperm' options.
Jan Safranek [Wed, 30 Nov 2011 14:42:08 +0000 (15:42 +0100)] 
cgconfigparser: Allow SUID and SGID permissions in 'fperm' and 'dperm' options.

libcgroup should allow SUID, SGID or sticky bit to be set either in
cgconfig.conf file or in API calls. Especially the sticky bit can be useful for
cooperation with systemd.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgconfigparser: Add 'default' section.
Jan Safranek [Wed, 30 Nov 2011 14:42:01 +0000 (15:42 +0100)] 
cgconfigparser: Add 'default' section.

'default' section in cgconfig.conf file describes default owner and
permissions of group's control and task files. Using the 'default' section,
the common permissions can be specified only once per config file instead
of defining it separately for each group.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agolibcgroup: Define NO_UID_GID.
Jan Safranek [Wed, 30 Nov 2011 14:41:53 +0000 (15:41 +0100)] 
libcgroup: Define NO_UID_GID.

Group control or task file owner should have UID/GID set to NO_UID_GID to
distinguish permissions which were set in config file from undefined
values. In the end, NO_UID_GID is transtated to UID/GID 0, so users
won't see any difference.

This will allow subsequent patches to set default owners of files/directories if
the group definition itself did not contain perm {} section.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolscgroup: Fixed too many '/' characters on output
Jan Safranek [Mon, 21 Nov 2011 12:55:46 +0000 (13:55 +0100)] 
lscgroup: Fixed too many '/' characters on output

Fix the calculation of path prefixes and prevent addtional slashes in
libcgroup output.

I.e. instead of:
$ lscgroup cpu:/
cpu:///
cpu:///system

show:
$ lscgroup cpu:/
cpu:/
cpu:/system

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Balbir Singh <bsingharora@gmail.com>
13 years agolibcgroup wrappers: Remove duplicated code
Dhaval Giani [Fri, 4 Nov 2011 11:46:54 +0000 (17:16 +0530)] 
libcgroup wrappers: Remove duplicated code

There is a lot of duplicated code in the wrappers. This is a hinderance
when one wants to change the basic design and in general maintainence.

Remove the duplicated code.

Also add a test case to test the changes.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
13 years agodoc: Man page updates
Jan Safranek [Thu, 3 Nov 2011 09:50:14 +0000 (10:50 +0100)] 
doc: Man page updates

Update cgconfig and cgclear man pages with new parameters.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agotests: Added cgconfig tests
Jan Safranek [Thu, 3 Nov 2011 09:50:11 +0000 (10:50 +0100)] 
tests: Added cgconfig tests

There are two tests:
 - cgclear_config_one - tests cgclear with one config file, incl. several error
   cases
 - cgclear_config_multi - tests cgclear with multiple config files, not so
   many error cases here

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: cgroup_delete_cgroup_ext was made namespace aware
Jan Safranek [Fri, 23 Sep 2011 11:53:47 +0000 (13:53 +0200)] 
libcgroup: cgroup_delete_cgroup_ext was made namespace aware

When namespace is used, a group can have different parents for different
controllers. cgroup_delete_cgroup_ext should reflect that.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgconfigparser: Allow multiple config files
Jan Safranek [Fri, 23 Sep 2011 11:53:40 +0000 (13:53 +0200)] 
cgconfigparser: Allow multiple config files

cgconfigparser can now parse multiple config files, including
(alphabetitcally sorted) files from a directory.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgclear: delete cgroups from config file
Jan Safranek [Fri, 23 Sep 2011 11:53:33 +0000 (13:53 +0200)] 
cgclear: delete cgroups from config file

cgclear should be able to 'uload' cgroups (and mounts) as specified in
given config file - as exact opposite of cgconfigparser.

This patch adds new options '-c <config_file>' and '-C <directory with config
files> just for this purpose. These options can be specified multiple times.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Added simple structure for list of strings.
Jan Safranek [Fri, 23 Sep 2011 11:53:27 +0000 (13:53 +0200)] 
libcgroup: Added simple structure for list of strings.

As preparation for next patches, simple list of strings is added to
tools-common.[ch]. It will be used as list of config files later.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: added cgroup_config_unload_config() function
Jan Safranek [Fri, 23 Sep 2011 11:53:20 +0000 (13:53 +0200)] 
libcgroup: added cgroup_config_unload_config() function

This function can be used to remove all groups and mounts defined in a
config file. See doxygen comments for details.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: free global config_cgroup_table
Jan Safranek [Fri, 23 Sep 2011 11:53:13 +0000 (13:53 +0200)] 
libcgroup: free global config_cgroup_table

To be able to call the cgroup_parse_config() several times without memory
leaks, its callers should free the memory it allocates when they don't need
it.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: allow parsing to be called several times
Jan Safranek [Fri, 23 Sep 2011 11:53:06 +0000 (13:53 +0200)] 
libcgroup: allow parsing to be called several times

cgroup_parse_config() should properly initialize its global variables, so
it can be called several times safely, i.e. several config files can be
parsed in sequence. The call to cgroup_parse_config() *rewrites* previous
result, it does not *add* new groups/mounts to global tables.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: the library can be re-initialize by cgroup_init()
Jan Safranek [Fri, 23 Sep 2011 11:52:59 +0000 (13:52 +0200)] 
libcgroup: the library can be re-initialize by cgroup_init()

cgroup_init() can be called several times in sequence. New call completelly
rewrites old data, i.e. things that were unmounted between two
cgroup_init() calls disappear and new mount points show up.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: split config parser to standalone function
Jan Safranek [Fri, 23 Sep 2011 11:52:53 +0000 (13:52 +0200)] 
libcgroup: split config parser to standalone function

New function cgroup_parse_config() to parse a config file is added, as
prerequisite of next patches.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: added new flag to cgroup_delete_cgroup_ext to delete only empty groups
Jan Safranek [Fri, 23 Sep 2011 11:52:46 +0000 (13:52 +0200)] 
libcgroup: added new flag to cgroup_delete_cgroup_ext to delete only empty groups

New flag CGFLAG_DELETE_EMPTY_ONLY tells cgroup_delete_cgroup_ext that the
group being deleted must be empty, i.e. have no subgroups and no tasks
inside.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agoAdded cgconfigparser test with fperm and dperm config options
Jan Safranek [Tue, 27 Sep 2011 06:50:09 +0000 (08:50 +0200)] 
Added cgconfigparser test with fperm and dperm config options

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: ignore 'tasks' file when changing permission of control files
Jan Safranek [Tue, 27 Sep 2011 06:50:09 +0000 (08:50 +0200)] 
libcgroup: ignore 'tasks' file when changing permission of control files

When cgroup_create_cgroup() is called with different control_fperm and
task_fperm, libcgroup first changes permissions of *all* files to match
the control_fperm, which includes the also the tasks file and it might
loose some permission bits. The tasks file is then modulated by
control_fperm, but because umask-style of control_fperm, it might get
lower permissions that users would expect.

Therefore 'tasks' file must be skipped when using control_fperm.

Changelog since v1:
  - use list of ignored files, cg_chmod_recursive_controller is called from
    cg_chmod_recursive, which should chmod all files, incl. 'tasks'.

Changelog since v2:
  - renamed the list with ignored files.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
13 years agolibcgroup: fixed chmod cg_chmod_recursive_controller
Jan Safranek [Tue, 27 Sep 2011 06:50:09 +0000 (08:50 +0200)] 
libcgroup: fixed chmod cg_chmod_recursive_controller

fts_read can return NULL in two cases. Either when we have visited all
files in the hierarchy (when errno is set to 0) or when an error
occured. We shouldn't set an error code in the first case obviously.

Changelog since v1:
 - updated log message

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
13 years agocgrulesengd: Fixed processing of symlinked executables.
Jan Safranek [Mon, 22 Aug 2011 08:48:58 +0000 (10:48 +0200)] 
cgrulesengd: Fixed processing of symlinked executables.

when an executable is symlinked and the symlink is executed,
/proc/PID/status contains name of the symlink, while /proc/PID/exe points
to the real executable name. cgrulesengd considered this case as error and
did not trigger any rule for this exec().

With this patch, cgrulesengd uses name of /proc/PID/exe as the executable
in this case.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Remove unreachable code
Jan Safranek [Wed, 24 Aug 2011 09:46:35 +0000 (11:46 +0200)] 
libcgroup: Remove unreachable code

The loop is broken in both if branches above, so it could never reach this
line -> remove it.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Fixed dereferencing of uninitialized variable when modifying a group
Jan Safranek [Wed, 24 Aug 2011 09:46:20 +0000 (11:46 +0200)] 
libcgroup: Fixed dereferencing of uninitialized variable when modifying a group

When group->index == 0, uninitialized variable path might get freed. Path is
always freed in the loop, so it is useless to free it before return.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgclear: Simplified error handling when unmounting controllers
Jan Safranek [Wed, 24 Aug 2011 09:46:08 +0000 (11:46 +0200)] 
cgclear: Simplified error handling when unmounting controllers

Reworked the error handling in cgroup_unload_cgroups.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Added checks for NULL when creating an internal dictionary
Jan Safranek [Wed, 24 Aug 2011 09:41:41 +0000 (11:41 +0200)] 
libcgroup: Added checks for NULL when creating an internal dictionary

Added one check for null when creating an internal dictionary
and fixed checking of calloc result.

Changelog:
  - rephrased the commit message

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agotests: Fixed memory leak in test_functions
Jan Safranek [Wed, 24 Aug 2011 09:41:34 +0000 (11:41 +0200)] 
tests: Fixed memory leak in test_functions

Free the cgroup on error.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agolssubsys: Fixed file descriptor leak on error enumerating controllers.
Jan Safranek [Wed, 24 Aug 2011 09:41:26 +0000 (11:41 +0200)] 
lssubsys: Fixed file descriptor leak on error enumerating controllers.

Close the iterator when cgroup_get_all_controller_next fails. I've
rewritten the loop to have one error check for both
cgroup_get_all_controller_begin and cgroup_get_all_controller_end.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Rework walk_tree iterator to release all resources on error.
Jan Safranek [Wed, 24 Aug 2011 09:41:19 +0000 (11:41 +0200)] 
libcgroup: Rework walk_tree iterator to release all resources on error.

cgroup_walk_tree_begin() can end up with error and in some code paths
'*handle' is not set and in some it is.

The function should free all resources on error + return *handle = NULL

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocgsnapshot: Fixed file descriptor leak when enumerating controllers
Jan Safranek [Wed, 24 Aug 2011 09:41:11 +0000 (11:41 +0200)] 
cgsnapshot: Fixed file descriptor leak when enumerating controllers

Close the iterators on error. In addition, handling when FL_SILENT flag is
on/off should be the same, except the error output.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgsnapshot: Fixed file descriptor leak when getting out of memory
Jan Safranek [Wed, 24 Aug 2011 09:41:04 +0000 (11:41 +0200)] 
cgsnapshot: Fixed file descriptor leak when getting out of memory

Close the iterator when cgroup_new_cgroup fails.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>