From 0d243f45ef8244f0361300bfef4871c155cdc16f Mon Sep 17 00:00:00 2001 From: Ken'ichi Ohmichi Date: Thu, 16 Sep 2010 14:08:59 +0900 Subject: [PATCH] Add the flag CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS. 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 Signed-off-by: Balbir Singh --- include/libcgroup/tasks.h | 3 ++- src/daemon/cgrulesengd.c | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/libcgroup/tasks.h b/include/libcgroup/tasks.h index aecfb43e..60ad383d 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 c65908a0..b96107d7 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)); -- 2.47.2