From: Sukadev Bhattiprolu <[email protected]>
Date: Fri, 5 Mar 2010 10:24:53 -0800
Subject: [PATCH 10/14][user-cr] Have app_restart() return pid

On success, return the pid of a the root of the restarted process tree.
This would enable callers to manage the restarted process-tree as a cgroup.

Signed-off-by: Sukadev Bhattiprolu <[email protected]>
---
 restart-main.c |    7 ++++++-
 restart.c      |    6 ++++++
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/restart-main.c b/restart-main.c
index d3a1782..237742e 100644
--- a/restart-main.c
+++ b/restart-main.c
@@ -332,6 +332,7 @@ static void parse_args(struct app_restart_args *args, int 
argc, char *argv[])
 
 int main(int argc, char *argv[])
 {
+       int ret;
        struct app_restart_args args;
 
        /*
@@ -345,6 +346,10 @@ int main(int argc, char *argv[])
 
        parse_args(&args, argc, argv);
 
-       return app_restart(&args);
+       ret = app_restart(&args);
+       if (ret > 0)
+               ret = 0;
+
+       return ret;
 }
 
diff --git a/restart.c b/restart.c
index 0118ad9..b6ee23c 100644
--- a/restart.c
+++ b/restart.c
@@ -490,6 +490,12 @@ int app_restart(struct app_restart_args *args)
                ret = ckpt_coordinator(&ctx);
        }
 
+       /*
+        * On success, return pid of root of the restart process tree.
+        */
+       if (ret >= 0)
+               ret = global_child_pid;
+
        return ret;
 }
 
-- 
1.6.0.4

_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to