[CRIU] [PATCH cr 03/10] restore: calculate a maximum value of PID-s
Andrey Vagin
avagin at openvz.org
Tue Jun 19 08:46:54 EDT 2012
It will be used for allocating PIDs for helper tasks
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
cr-restore.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/cr-restore.c b/cr-restore.c
index ce28b44..7e5b003 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -68,6 +68,7 @@ static int shmem_remap(void *old_addr, void *new_addr, unsigned long size)
return 0;
}
+static int max_pid = 0;
static int prepare_pstree(void)
{
int ret = 0, i, ps_fd;
@@ -101,8 +102,16 @@ static int prepare_pstree(void)
break;
pi->pid = e.pid;
+ if (e.pid > max_pid)
+ max_pid = e.pid;
+
pi->pgid = e.pgid;
+ if (e.pgid > max_pid)
+ max_pid = e.pgid;
+
pi->sid = e.sid;
+ if (e.sid > max_pid)
+ max_pid = e.sid;
if (e.ppid == 0) {
BUG_ON(root_item);
--
1.7.1
More information about the CRIU
mailing list