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>