Commit 018e8985 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

dump: collect all pid-s in rbtree

We already do this on restore to be able to search tasks by their virtual PID-s.
Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent a1709f6e
......@@ -828,6 +828,7 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl,
pr_err("Can't dump thread for pid %d\n", pid);
goto err;
}
pstree_insert_pid(tid->virt, tid);
img = open_image(CR_FD_CORE, O_DUMP, tid->virt);
if (!img)
......@@ -1284,6 +1285,7 @@ static int dump_one_task(struct pstree_item *item)
}
parasite_ctl->pid.virt = item->pid.virt = misc.pid;
pstree_insert_pid(item->pid.virt, &item->pid);
item->sid = misc.sid;
item->pgid = misc.pgid;
......
......@@ -67,6 +67,7 @@ extern struct pstree_item *__alloc_pstree_item(bool rst);
extern void init_pstree_helper(struct pstree_item *ret);
extern struct pstree_item *lookup_create_item(pid_t pid);
extern void pstree_insert_pid(pid_t pid, struct pid *pid_node);
extern struct pstree_item *root_item;
extern struct pstree_item *pstree_item_next(struct pstree_item *item);
......
......@@ -2145,6 +2145,7 @@ int parse_threads(int pid, struct pid **_t, int *_n)
t[nr - 1].virt = -1;
}
t[nr - 1].real = atoi(de->d_name);
t[nr - 1].state = TASK_THREAD;
nr++;
}
......
......@@ -409,6 +409,15 @@ static struct pid *lookup_create_pid(pid_t pid, struct pid *pid_node)
return pid_node;
}
void pstree_insert_pid(pid_t pid, struct pid *pid_node)
{
struct pid* n;
n = lookup_create_pid(pid, pid_node);
BUG_ON(n != pid_node);
}
struct pstree_item *lookup_create_item(pid_t pid)
{
struct pid *node;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment