]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Add the flag CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS.
authorKen'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Thu, 16 Sep 2010 05:08:59 +0000 (14:08 +0900)
committerBalbir Singh <balbir@linux.vnet.ibm.com>
Fri, 24 Sep 2010 06:09:22 +0000 (11:39 +0530)
Hi,

A new flag CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS cancels the unchanged process.
If specifying this flag as the argument of cgroup_register_unchanged_process,
a cgrulesengd daemon can move the specified process to right cgroup based on
/etc/cgrules.conf.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
include/libcgroup/tasks.h
src/daemon/cgrulesengd.c

index aecfb43ecdfe179dcf42e4ed63c48291cf76e268..60ad383d96587a3fd55c687497a126a1add9ae91 100644 (file)
@@ -24,7 +24,8 @@ enum cgroup_daemon_type {
         * The daemon must not touch the given task, i.e. it never moves it
         * to any controlgroup.
         */
-       CGROUP_DAEMON_UNCHANGE_CHILDREN = 0x1,
+       CGROUP_DAEMON_UNCHANGE_CHILDREN       = 0x1,
+       CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS = 0x2,
 };
 
 /**
index c65908a00c17325f691fd64e9fbc0794ca0b4bb4..b96107d72af839848633333b505ed11be09d7455 100644 (file)
@@ -549,9 +549,12 @@ static void cgre_receive_unix_domain_msg(int sk_unix)
                cgroup_dbg("read error: %s\n", strerror(errno));
                goto close;
        }
-       if (cgre_store_unchanged_process(pid, flags))
-               goto close;
-
+       if (flags == CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS) {
+               cgre_remove_unchanged_process(pid);
+       } else {
+               if (cgre_store_unchanged_process(pid, flags))
+                       goto close;
+       }
        if (write(fd_client, CGRULE_SUCCESS_STORE_PID,
                        sizeof(CGRULE_SUCCESS_STORE_PID)) < 0) {
                cgroup_dbg("write error: %s\n", strerror(errno));