]> git.ipfire.org Git - thirdparty/libcgroup.git/log
thirdparty/libcgroup.git
11 years agolssubsys: polish usage function
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:18:43 +0000 (07:18 +0200)] 
lssubsys: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of lssubsys tool. Remove a level of indentation.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agolscgroup: unify help output
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:18:23 +0000 (07:18 +0200)] 
lscgroup: unify help output

lscgroup: unify help output
* use tabulators instead of spaces
* at first describe the functionality and then describe options
* use printf instead fprintf(stdout,..)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agolscgroup: polish usage function
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:18:03 +0000 (07:18 +0200)] 
lscgroup: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of lscgroup tool. Remove a level of indentation.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgsnapshot: unify help output
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:17:52 +0000 (07:17 +0200)] 
cgsnapshot: unify help output

cgsnapshot: unify help output
* use tabulators instead of spaces
* change formulation
* change fprintf(stdout,...) to printf()

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgsnapshot: polish usage function
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:17:19 +0000 (07:17 +0200)] 
cgsnapshot: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of cgsnapshot tool. Remove a level of indentation.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgset: polish usage function
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:17:07 +0000 (07:17 +0200)] 
cgset: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of cgset tool. Remove a level of indentation.
Use tabulators instead of spaces.
Based on Jan's comment change typo display->set in -g description

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgget: polish usage function
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:11:19 +0000 (07:11 +0200)] 
cgget: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of cgget tool. Remove a level of indentation.
Use printf instead of fprintf(stdout,...)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgexec: unify the help output
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:11:02 +0000 (07:11 +0200)] 
cgexec: unify the help output

cgexec: unify the help output - add -h option info

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgexec: polish usage function
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:10:21 +0000 (07:10 +0200)] 
cgexec: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of cgexec tool. Remove a level of
indentation.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgdelete: unification of usage function output
Ivana Hutarova Varekova [Fri, 27 Sep 2013 05:09:56 +0000 (07:09 +0200)] 
cgdelete: unification of usage function output

cgdelete use spaces instead of tabulator
use printf instead of fprintf(stdout,...)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgdelete: polish usage function
Ivana Hutarova Varekova [Thu, 26 Sep 2013 17:30:04 +0000 (19:30 +0200)] 
cgdelete: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of cgdelete tool. Remove a level of indentation.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgcreate: polish usage function
Ivana Hutarova Varekova [Thu, 26 Sep 2013 10:00:16 +0000 (12:00 +0200)] 
cgcreate: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of cgcreate tool. Remove a level of indentation.
use printf instead of fprintf(stderr,...)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgconfig: unify the help output
Ivana Hutarova Varekova [Thu, 26 Sep 2013 09:59:32 +0000 (11:59 +0200)] 
cgconfig: unify the help output

Remove cgconfig input free row and change the output program name to standardize
the output with the other libcgroup tools.
sort options based on alphabetical order

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgclear: unify help output
Ivana Hutarova Varekova [Thu, 26 Sep 2013 09:58:39 +0000 (11:58 +0200)] 
cgclear: unify help output

cgclear: unify help output
put the options to chronological order

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgconfig: polish usage function
Ivana Hutarova Varekova [Thu, 26 Sep 2013 09:57:26 +0000 (11:57 +0200)] 
cgconfig: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of cgconfig tool. Remove a level of indentation.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgclear: polish usage function
Ivana Hutarova Varekova [Thu, 26 Sep 2013 09:57:06 +0000 (11:57 +0200)] 
cgclear: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage" function of cgclear tool. Remove a level of indentation.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgclassify: unify help output
Ivana Hutarova Varekova [Thu, 26 Sep 2013 09:56:33 +0000 (11:56 +0200)] 
cgclassify: unify help output

cgclassify: unify help output
* -g option is optional
* use the alphabetical order
* add -h option description

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agocgclassify: polish usage function
Ivana Hutarova Varekova [Thu, 26 Sep 2013 09:53:33 +0000 (11:53 +0200)] 
cgclassify: polish usage function

This change is suggested by Dhaval Giani <dhaval.giani@gmail.com>.
Polish "usage function and remove a level of indentation.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
11 years agocgconfig: change function usage behavior
Libo Chen [Thu, 12 Sep 2013 06:38:34 +0000 (08:38 +0200)] 
cgconfig: change function usage behavior

remove exit from function usage and add a structure like usage function
in the other tools.
This is suggested by Ivana Hutarova Varekova <varekova@redhat.com>

now usage willn't exit, so we should help it in err case.

v4:
 - fix some code style reported by checkpatch.pl

Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
11 years agocgconfig: add check and nonzero
Libo Chen [Tue, 10 Sep 2013 06:29:17 +0000 (08:29 +0200)] 
cgconfig: add check and nonzero

1. check return value of cgroup_string_list_init.
2. add nonzero for -a and -t

v4:
 - add nonzero for cgroup_new_cgroup

Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
11 years agocgconfig: correct freeing default_cgroup
Libo Chen [Tue, 10 Sep 2013 06:27:05 +0000 (08:27 +0200)] 
cgconfig: correct freeing default_cgroup

We are freeing up default_cgroup even it has not be allocated,
there is no need to do that.

Yes, it is just a cleanup suggested
by Dhaval Giani <dhaval.giani@gmail.com>

Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
11 years agocgconfig: add parameter check
Libo Chen [Tue, 10 Sep 2013 06:22:04 +0000 (08:22 +0200)] 
cgconfig: add parameter check

we should check invalite parameter, and then print a warning

v3:
 - usage has changed, so no need of fprintf output
v2:
 - change print info format. This is suggested
   by Dhaval Giani <dhaval.giani@gmail.com>

Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
11 years agocgconfig: fix the excursive processing
Libo Chen [Tue, 10 Sep 2013 06:18:32 +0000 (08:18 +0200)] 
cgconfig: fix the excursive processing

error and ret should be unified

v4:
 - use error for cgroup_string_list_add_item
   goto err lable instead of exit

Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
11 years agocgconfig: add err check
Libo Chen [Tue, 10 Sep 2013 06:13:56 +0000 (08:13 +0200)] 
cgconfig: add err check

cgroup still can be created even if giving invalid -d,-f,-s parameter.
e.g.
        cgconfigparser  -d 888 -l /etc/cgconfig.conf
        "888" is invalid, but cgroup will be created.

        So we should exit when -d,-f or -s is invalid.

v3:
 - add nonzero return value
 - use error instead of ret

Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
11 years agocgcreate: add err check
Libo Chen [Tue, 10 Sep 2013 06:11:56 +0000 (08:11 +0200)] 
cgcreate: add err check

cgroup still can be created even if giving invalid -d,-f,-s parameter
e.g.
        cgcreate -g cpu:/test -d 888
        "888" is invalid, but test will be cgreated.

        So we should exit if -d,-f or -s is invalid

v2:
 - add nonzero return value

Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
11 years agocgred:cgred should start when cgroup is mounted
Weng Meiling [Tue, 10 Sep 2013 06:06:20 +0000 (08:06 +0200)] 
cgred:cgred should start when cgroup is mounted

If we mount the cgroup without the name cgroup like the following:
cpu on /cgroup/cpu type cgroup (rw,cpu)

the cgred service will start failed, because it just check the name.
So changing cgred to check the mounted system's type instead of the name.

v1 -> v2
Using the right method to check cgroup filesystem. The first version
patch's method is wrong, so resend the second patch.

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
11 years agocgsnapshot: don't display mountpoints which are not wanted
Ivana Hutarova Varekova [Mon, 2 Sep 2013 11:49:35 +0000 (13:49 +0200)] 
cgsnapshot: don't display mountpoints which are not wanted

the first version of this patch was created by Libo Chen <clbchenlibo.chen@...>
see http://sourceforge.net/p/libcg/mailman/libcg-devel/thread/51FB6459.9000307%40huawei.com/#msg31243958

before patch:
        #lscgroup
        cpu:/
        cpuset:/

        #cgsnapshot -s cpu

        mount {
            cpuset = /cgroup/cpuacct;
            cpu = /cgroup/cpu;
        }

We just wanted to save cpu controller, so cpuset was unexpected

Changelog:
     * parse controller list only if the list is set, if there is no restriction display all hierarchies
     * parse named list as well, thus they are not output if they are not wanted
     * remove TODO comment

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Reported-by: Libo Chen <clbchenlibo.chen@...>
Acked-by: Jan Safranek <jsafrane@redhat.com>
11 years agolog.h: add head file <stdarg.h>
Libo Chen [Sun, 1 Sep 2013 12:53:11 +0000 (14:53 +0200)] 
log.h: add head file <stdarg.h>

libcg was compiled failed in suse sp2 with libc-2.11.3:
"include/libcgroup/log.h:90: error: expected declaration specifiers
or '...' before 'va_list'"

 so add #include <stdarg.h>

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
Committer: Ivana Hutarova Varekova <varekova@redhat.com>

12 years agocreate_cgroup_from_name_value_pairs can't deal n/v pairs from the same controller
Ivana Hutarova Varekova [Tue, 30 Jul 2013 07:57:07 +0000 (09:57 +0200)] 
create_cgroup_from_name_value_pairs can't deal n/v pairs from the same controller

create_cgroup_from_name_value_pairs can't deal name/value pairs from the
same controller
E.G.
    cgset -r cpu.cfs_quota_us=400000 -r cpu.cfs_period_us=400000 cgroup
This patch fix the problem.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agocgclassify: use the error message instead of error number
Weng Meiling [Wed, 24 Jul 2013 15:46:27 +0000 (17:46 +0200)] 
cgclassify: use the error message instead of error number

It's more readable and friendly to use the detailed error
message instead of error number as other places.

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Acked-by: Ivana Hutarov Varekova <varekova@redhat.com>
12 years agoIt's more readable and friendly to use the enum value instead of number.
Weng Meiling [Tue, 23 Jul 2013 12:58:20 +0000 (14:58 +0200)] 
It's more readable and friendly to use the enum value instead of number.

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agowhen we use cgsnapshot with the given controller, the result always
Weng Meiling [Tue, 23 Jul 2013 12:30:33 +0000 (14:30 +0200)] 
when we use cgsnapshot with the given controller, the result always
displays
the last mounted controller which is not specified, so fix it.

Example:

# lssubsys  -m
cpuset /cgroup/cpuset
cpu /cgroup/cpu
# lscgroup
cpu:/
cpu:/test
cpuset:/
cpuset:/test

before the patch:

# cgsnapshot -s cpu
# Configuration file generated by cgsnapshot
mount {
cpuset = /cgroup/cpuset;
cpu = /cgroup/cpu;
}

group test {
cpu {
cpu.rt_period_us="1000000";
cpu.rt_runtime_us="0";
cpu.shares="1024";
}
}

group test {
cpuset {
cpuset.memory_spread_slab="0";
cpuset.memory_spread_page="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="";
}
}

after the patch:

# cgsnapshot -s cpu
# Configuration file generated by cgsnapshot
mount {
cpuset = /cgroup/cpuset;
cpu = /cgroup/cpu;
}

group test {
cpu {
cpu.rt_period_us="1000000";
cpu.rt_runtime_us="0";
cpu.shares="1024";
}
}

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
12 years agolex: suppress useless warning message during compilation
Ivana Hutarova Varekova [Thu, 18 Jul 2013 10:52:53 +0000 (12:52 +0200)] 
lex: suppress useless warning message during compilation

use pragma section to suppress
error: 'yy_fatal_error'
defined but not used message

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agoparse: fix template parsing
Ivana Hutarova Varekova [Thu, 18 Jul 2013 10:51:46 +0000 (12:51 +0200)] 
parse: fix template parsing

The old version has problem with name/value pairs parsing in template
tag in parse.y. This patch fix it.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agoconfig.c: better detect whether template group already is created
Ivana Hutarova Varekova [Thu, 18 Jul 2013 10:51:41 +0000 (12:51 +0200)] 
config.c: better detect whether template group already is created

cgroup_config_create_template_group: properly detect whether template group was created

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agodocumentation: fix cgroup_copy cgroup description
Ivana Hutarova Varekova [Thu, 18 Jul 2013 10:28:55 +0000 (12:28 +0200)] 
documentation: fix cgroup_copy cgroup description

fix cgroup_copy_cgroup description. There should be obvious this function only copy the controller stuff. It does not copy permissions, name and ownership.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agofix template function to copy template groups properly
Ivana Hutarova Varekova [Thu, 18 Jul 2013 10:07:29 +0000 (12:07 +0200)] 
fix template function to copy template groups properly

This patch fixes cgroup_init_templates_cache and cgroup_reload_cached_templates functions. Their have to copy  not only
controllers and their structures but all variables (controller name, permissions and ownership) for templates.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agocgsnapshot: fix the print message when use cgsnapshot with -f
Weng Meiling [Tue, 25 Jun 2013 07:53:22 +0000 (09:53 +0200)] 
cgsnapshot: fix the print message when use cgsnapshot with -f

When use cgsnapshot with -f to save current configuration of cgroups,
the mount section is missing, this patch fix it.

the example as following:
# cgsnapshot -s -f config
        cpu = /cgroup/cpu;
# cat config
# Configuration file generated by cgsnapshot
mount {
}

group test {
        cpu {
                cpu.rt_period_us="1000000";
                cpu.rt_runtime_us="0";
                cpu.cfs_period_us="100000";
                cpu.cfs_quota_us="-1";
                cpu.shares="1024";
        }
}

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoCgred service won't start if /etc/cgrules.conf is missing
Peter Schiffer [Tue, 25 Jun 2013 04:47:47 +0000 (06:47 +0200)] 
Cgred service won't start if /etc/cgrules.conf is missing

By default, the /etc/cgrules.conf file contains only comments. If this is the case, the cgred service starts without problem. But if /etc/cgrules.conf file is empty or missing, the cgred service won't start, even this case is equivalent with the first one.

This patch allows the cgred service start even when the /etc/cgrules.conf files is empty, or missing.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoUse cache when reading /etc/passwd file
Peter Schiffer [Tue, 25 Jun 2013 04:37:41 +0000 (06:37 +0200)] 
Use cache when reading /etc/passwd file

Currently, libcgroup code reads /etc/passwd file once for every line in the cgrules.conf file, what can have performance impact on the login times if system contains thousands of users and cgrules.conf contains thousands of lines.

This patch adds CGFLAG_USECACHE flag to the cgroup_change_cgroup_uid_gid() function call which enables cache usage, and thus speeds up login times on those systems.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agocgroup_get_cgroup: remove bogus comment
Ivana Hutarova Varekova [Sun, 9 Jun 2013 04:47:18 +0000 (06:47 +0200)] 
cgroup_get_cgroup: remove bogus comment

cgroup_get_cgroup: remove bogus comment

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agofix permissions of logger.sh
Ivana Hutarova Varekova [Sun, 9 Jun 2013 04:46:35 +0000 (06:46 +0200)] 
fix permissions of logger.sh

change permissions to 755 to enable the file to be executed

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agoremove useless cgroup_rules_loaded
Ivana Hutarova Varekova [Sun, 9 Jun 2013 04:46:09 +0000 (06:46 +0200)] 
remove useless cgroup_rules_loaded

I don't see the reason to have cgroup_rules_loaded variable.
It is set but not used any more. Thus I'm removing it. Reply an e-mail if I'm wrong.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agov0.40.rc1
Ivana Hutarova Varekova [Tue, 21 May 2013 13:10:16 +0000 (15:10 +0200)] 
v0.40.rc1

I am releasing v0.40.rc1.

The major changes are template stuff and new logging.

List of all patches:
    Ivana Hutarova Varekova (12):
          cgrules.conf: no documentation inside config file
          cgroup_change_cgroup_flags: create template control group on the fly
          cgconfigparser: add template tag to cgconfigparser
          cgconfig.conf: parse template tag and fill relevant structures
          config.h: create function for init/reload cgconfig template cache
          api: add function for creating template control groups
          cgrulesengd: cache templates
          cgroup_change_cgroup_flags: use templates if they are in rules
          update documentation to reflect the changes regarding templates
          api.c: cgroup_create_template_group templates crashing
          templates have to be coppied in proper way to template_table structure
          remove useless include from log.h

    John Fastabend (1):
          libcg: scan running tasks at start time to classify existing pids

    Peter Schiffer (15):
          Removed cgroup_dbg from cgrulesengd
          Reworked libcgroup logging
          Enabled default logging
          Reworked logging configuration
          Added parsing of CGROUP_LOGLEVEL
          Recognize DEBUG level of CGROUP_LOGLEVEL variable in daemon
          Fixed cgrulesengd to log libcgroup log messages to syslog
          Changed log level of various messages
          Added new errors/warnings
          Enabled logging in cgconfigparser
          Added new logging to the tools
          Added a test for the new logging
          Added CGROUP_LOGLEVEL to man pages + fixed the style of 'FILES' section     where appropriate.
          Update default logging for cgrulesengd
          Make cg_mkdir_p() function compatible with read-only fs

    Robert Milasan (1):
          fix defaultcgroup detection (better description)

    Roberto Polli (1):
          support indented comments in cgconfigparser

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoremove useless include from log.h
Ivana Hutarova Varekova [Tue, 21 May 2013 09:25:59 +0000 (11:25 +0200)] 
remove useless include from log.h

stdarg.h include in log.h is useless. This patch removes it.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
12 years agoMake cg_mkdir_p() function compatible with read-only fs
Peter Schiffer [Thu, 16 May 2013 15:10:32 +0000 (17:10 +0200)] 
Make cg_mkdir_p() function compatible with read-only fs

mkdir(2) function returns EROFS error even when the path already exists on
the read only file system, so it is impossible to determine whether the path
already exists on this kind of fs only be return code from the mkdir(2). To make
cg_mkdir_p() compatible with the ro fs, the function checks whether the
path exists with stat(2) before trying to create it.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
12 years agosupport indented comments in cgconfigparser
Roberto Polli [Sun, 12 May 2013 11:22:39 +0000 (13:22 +0200)] 
support indented comments in cgconfigparser

support indented comments in cgconfigparser

Signed-off-by: Roberto Polli <robipolli@gmail.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agotemplates have to be coppied in proper way to template_table structure
Ivana Hutarova Varekova [Thu, 9 May 2013 12:04:00 +0000 (14:04 +0200)] 
templates have to be coppied in proper way to template_table structure

cgroup_reload_cached_templates and cgroup_init_templates_cache functions fill structure template_table in old version the data are coppied
(memcpy function) from config_template_table.
This causes problem if both template_table and config_template_table are reloaded or if config_template_table is updated. Patch fix this problem and copy data properly (cgroup_copy_cgroup function)
    The reproducer of this bug is described in http://sourceforge.net/mailarchive/forum.php?thread_name=khtfkj%24c8l%241%40ger.gmane.org&forum_name=libcg-devel

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
12 years agoapi.c: cgroup_create_template_group templates crashing
Ivana Hutarova Varekova [Thu, 9 May 2013 11:51:19 +0000 (13:51 +0200)] 
api.c: cgroup_create_template_group templates crashing

cgroup_create_template_group procedure writes to the first place of string of characters even if the varible points to NULL. As the result templates crashes.
See http://sourceforge.net/mailarchive/forum.php?thread_name=khtfkj%24c8l%241%40ger.gmane.org&forum_name=libcg-devel

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
12 years agoUpdate default logging for cgrulesengd
Peter Schiffer [Tue, 2 Apr 2013 08:57:07 +0000 (10:57 +0200)] 
Update default logging for cgrulesengd

Cgrulesengd is using different default logging level than the library.
Currently
it's set to WARNING, which is not consistend with the rest of the library.
This
patch sets the default logging level to ERROR.

This patch also unifies logging levels with default logging system used in
libcg, be removing LOG_NOTICE and replacing it with LOG_INFO.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoAdded CGROUP_LOGLEVEL to man pages + fixed the style of 'FILES' section
Peter Schiffer [Tue, 2 Apr 2013 08:57:02 +0000 (10:57 +0200)] 
Added CGROUP_LOGLEVEL to man pages + fixed the style of 'FILES' section
where appropriate.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoAdded a test for the new logging
Peter Schiffer [Tue, 2 Apr 2013 08:57:01 +0000 (10:57 +0200)] 
Added a test for the new logging

New simple tests, testing
 - standard (stdout) callback
 - custom application callback
 - all loglevels
 - automatic loglevel extraction from CGROUP_LOGLEVEL

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoAdded new logging to the tools
Peter Schiffer [Tue, 2 Apr 2013 08:56:52 +0000 (10:56 +0200)] 
Added new logging to the tools

Tools should use cgroup_log now.

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

cgconfigparser calls cgroup_init too late, it's necessary to initialize
libcgroup logging earlier in the process, so various messages get visible
to user.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoAdded new errors/warnings
Peter Schiffer [Tue, 2 Apr 2013 08:56:45 +0000 (10:56 +0200)] 
Added new errors/warnings

I've put few errors and warnings where I find them appropriate - usually
when a function returns error and the user might be interested exactly what
file/directory is bad.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoChanged log level of various messages
Peter Schiffer [Tue, 2 Apr 2013 08:55:40 +0000 (10:55 +0200)] 
Changed log level of various messages

I went through cgroup_dbg messages and increased they log level where I
found it appropriate. I am pretty sure I missed other important ones, this
is just a first attempt. Feel free to suggest additional messages.

Changelog:
  - fixed capital letters in few log messages

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoFixed cgrulesengd to log libcgroup log messages to syslog
Peter Schiffer [Tue, 2 Apr 2013 08:55:38 +0000 (10:55 +0200)] 
Fixed cgrulesengd to log libcgroup log messages to syslog

Now we have the infrastructure, libcgroup log messages should be sent
together with cgrulesengd ones to syslog.

As side effect, all flog messages must end with '\n' to match libcgroup
standards.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
12 years agoRecognize DEBUG level of CGROUP_LOGLEVEL variable in daemon
Peter Schiffer [Tue, 2 Apr 2013 08:55:33 +0000 (10:55 +0200)] 
Recognize DEBUG level of CGROUP_LOGLEVEL variable in daemon

If CGROUP_LOGLEVEL=DEBUG environment variable is set, enable --debug
verbosity
level in the cgrulesengd daemon.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
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>