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 <[email protected]>
---
diff --git a/include/libcgroup/tasks.h b/include/libcgroup/tasks.h
index aecfb43..60ad383 100644
--- a/include/libcgroup/tasks.h
+++ b/include/libcgroup/tasks.h
@@ -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,
 };
 
 /**
diff --git a/src/daemon/cgrulesengd.c b/src/daemon/cgrulesengd.c
index c65908a..b96107d 100644
--- a/src/daemon/cgrulesengd.c
+++ b/src/daemon/cgrulesengd.c
@@ -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));

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to