[CRIU] [PATCH] pstree: Rename @max_pid to @helper_task_pid

Cyrill Gorcunov gorcunov at openvz.org
Tue Oct 2 10:49:17 EDT 2012


This name is too abstract, rename it trying to
explain why we need it.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 pstree.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/pstree.c b/pstree.c
index 6033e7e..a464107 100644
--- a/pstree.c
+++ b/pstree.c
@@ -116,7 +116,13 @@ err:
 	return ret;
 }
 
-static int max_pid = 0;
+/*
+ * This is the pid we use for helper tasks, it should
+ * not ever intersect with any pid in process tree we're
+ * restoring.
+ */
+static int helper_task_pid = 0;
+
 int prepare_pstree(void)
 {
 	int ret = 0, i, ps_fd;
@@ -141,13 +147,13 @@ int prepare_pstree(void)
 			break;
 
 		pi->pid.virt = e->pid;
-		max_pid = max((int)e->pid, max_pid);
+		helper_task_pid = max((int)e->pid, helper_task_pid);
 
 		pi->pgid = e->pgid;
-		max_pid = max((int)e->pgid, max_pid);
+		helper_task_pid = max((int)e->pgid, helper_task_pid);
 
 		pi->sid = e->sid;
-		max_pid = max((int)e->sid, max_pid);
+		helper_task_pid = max((int)e->sid, helper_task_pid);
 
 		if (e->ppid == 0) {
 			if (root_item) {
@@ -300,7 +306,7 @@ int prepare_pstree_ids(void)
 				continue;
 
 			child->pgid = item->pgid;
-			child->pid.virt = ++max_pid;
+			child->pid.virt = ++helper_task_pid;
 			child->parent = item;
 			list_move(&child->list, &item->children);
 
-- 
1.7.7.6



More information about the CRIU mailing list