mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
pstree: Link pid and pstree_item
Add a link from task's pid to pstree_item. Threads have this link set in NULL. travis-ci: success for Make pstree_item::pid allocated dynamically Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
13a0efaf23
commit
9af2eff929
@@ -5,6 +5,7 @@
|
||||
#include "rbtree.h"
|
||||
|
||||
struct pid {
|
||||
struct pstree_item *item;
|
||||
/*
|
||||
* The @real pid is used to fetch tasks during dumping stage,
|
||||
* This is a global pid seen from the context where the dumping
|
||||
|
@@ -216,6 +216,7 @@ struct pstree_item *__alloc_pstree_item(bool rst)
|
||||
item->pid.virt = -1;
|
||||
item->pid.real = -1;
|
||||
item->born_sid = -1;
|
||||
item->pid.item = item;
|
||||
|
||||
return item;
|
||||
}
|
||||
@@ -554,6 +555,7 @@ static int read_pstree_image(pid_t *pid_max)
|
||||
pi->threads[i].real = -1;
|
||||
pi->threads[i].virt = e->threads[i];
|
||||
pi->threads[i].state = TASK_THREAD;
|
||||
pi->threads[i].item = NULL;
|
||||
if (i == 0)
|
||||
continue; /* A thread leader is in a tree already */
|
||||
node = lookup_create_pid(pi->threads[i].virt, &pi->threads[i]);
|
||||
|
@@ -695,6 +695,7 @@ static int collect_threads(struct pstree_item *item)
|
||||
if (item->nr_threads == 0) {
|
||||
item->threads[0].real = item->pid.real;
|
||||
item->nr_threads = 1;
|
||||
item->threads[0].item = NULL;
|
||||
}
|
||||
|
||||
nr_inprogress = 0;
|
||||
@@ -732,6 +733,7 @@ static int collect_threads(struct pstree_item *item)
|
||||
|
||||
BUG_ON(item->nr_threads + 1 > nr_threads);
|
||||
item->threads[item->nr_threads].real = pid;
|
||||
item->threads[item->nr_threads].item = NULL;
|
||||
item->nr_threads++;
|
||||
|
||||
if (ret == TASK_DEAD) {
|
||||
|
Reference in New Issue
Block a user