Hi,

Changelog of v2:
================
* New patch.

This patch applies a new rule to 'cgexec' command.

cgroup_register_unchanged_process() is called so that cgrulesengd
daemon does not change the cgroup of a process, which is executed
by 'cgexec' command.
And cgroup_change_cgroup_flags() is called for applying a new rule.


Thanks
Ken'ichi Ohmichi

Signed-off-by: Ken'ichi Ohmichi <[email protected]>
---
 src/tools/cgexec.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/tools/cgexec.c b/src/tools/cgexec.c
index 0853894..847662c 100644
--- a/src/tools/cgexec.c
+++ b/src/tools/cgexec.c
@@ -85,6 +85,12 @@ int main(int argc, char *argv[])
        egid = getegid();
        pid = getpid();
 
+       ret = cgroup_register_unchanged_process(pid, 0);
+       if (ret) {
+               fprintf(stderr, "registration of process failed\n");
+               return ret;
+       }
+
        if (cg_specified) {
                /*
                 * User has specified the list of control group and
@@ -106,7 +112,8 @@ int main(int argc, char *argv[])
        } else {
 
                /* Change the cgroup by determining the rules based on euid */
-               ret = cgroup_change_cgroup_uid_gid(euid, egid, pid);
+               ret = cgroup_change_cgroup_flags(euid, egid,
+                                               argv[optind], pid, 0);
                if (ret) {
                        fprintf(stderr, "cgroup change of group failed\n");
                        return ret;

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to