]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
cgroup_change_cgroup_flags: create template control group on the fly
authorIvana Hutarova Varekova <varekova@redhat.com>
Mon, 28 Jan 2013 13:31:43 +0000 (14:31 +0100)
committerIvana Hutarova Varekova <varekova@redhat.com>
Mon, 28 Jan 2013 13:31:43 +0000 (14:31 +0100)
commit304b89365575fbf1d1834ff65b6398c691991696
tree014088b9a1842cc01ba0404c837f58669285f900
parent9659403b713f947fb4c1518c7417173623ddded8
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>
src/api.c