]> 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:11:04 +0000 (11:41 +0530)
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>
doc/man/cgclassify.1
src/tools/cgclassify.c

index c03003ff2c000a8076e52d2a542e7aaca8c5ca6e..2d8921bce38d94a6d52b61dd40f0ff38f013fdf5 100644 (file)
@@ -6,7 +6,7 @@
 cgclassify \- move running task(s) to given cgroups
 
 .SH SYNOPSIS
-\fBcgclassify\fR [\fB-g\fR <\fIcontrollers>:<path\fR>] [--sticky] <\fIpidlist\fR>
+\fBcgclassify\fR [\fB-g\fR <\fIcontrollers>:<path\fR>] [--sticky | --cancel-sticky] <\fIpidlist\fR>
 
 .SH DESCRIPTION
 this command moves processes defined by the list
@@ -41,6 +41,13 @@ children tasks. Without this option, the daemon does not change the
 specified \fBpidlist\fR but it changes their children tasks to the
 right cgroup based on \fB/etc/cgrules.conf\fR automatically.
 
+.TP
+.B --cancel-sticky
+If this option is used, the daemon of service cgred (cgrulesengd
+process) can change both the specified \fBpidlist\fR and their
+children tasks to right cgroup based on \fB/etc/cgrules.conf\fR
+automatically.
+
 .SH FILES
 .LP
 .PD .1v
index a0d047b24faaf2e8c5747230c0956921d00b6d05..31811058b7ede22783b8078c60f24ce19bc5826e 100644 (file)
@@ -93,6 +93,7 @@ out:
 
 static struct option longopts[] = {
        {"sticky", no_argument, NULL, 's'},
+       {"cancel-sticky", no_argument, NULL, 'u'},
        {0, 0, 0, 0}
 };
 
@@ -101,7 +102,7 @@ int main(int argc, char *argv[])
        int ret = 0, i, exit_code = 0;
        pid_t pid;
        int cg_specified = 0;
-       int flag_child = 0;
+       int flag = 0;
        struct cgroup_group_spec *cgroup_list[CG_HIER_MAX];
        int c;
 
@@ -109,7 +110,7 @@ int main(int argc, char *argv[])
        if (argc < 2) {
                fprintf(stderr, "usage is %s "
                        "[-g <list of controllers>:<relative path to cgroup>] "
-                       "[--sticky] <list of pids>  \n",
+                       "[--sticky | --cancel-sticky] <list of pids>  \n",
                        argv[0]);
                exit(2);
        }
@@ -128,7 +129,10 @@ int main(int argc, char *argv[])
                        cg_specified = 1;
                        break;
                case 's':
-                       flag_child |= CGROUP_DAEMON_UNCHANGE_CHILDREN;
+                       flag |= CGROUP_DAEMON_UNCHANGE_CHILDREN;
+                       break;
+               case 'u':
+                       flag |= CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS;
                        break;
                default:
                        fprintf(stderr, "Invalid command line option\n");
@@ -148,8 +152,8 @@ int main(int argc, char *argv[])
        for (i = optind; i < argc; i++) {
                pid = (uid_t) atoi(argv[i]);
 
-               if (flag_child)
-                       ret = cgroup_register_unchanged_process(pid, flag_child);
+               if (flag)
+                       ret = cgroup_register_unchanged_process(pid, flag);
                if (ret)
                        exit_code = 1;