2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

dump: Sanitize threads dumping

Merge two calls into one helper. For future.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
Pavel Emelyanov 2012-03-01 19:02:03 +04:00 committed by Cyrill Gorcunov
parent 3ab9285f0f
commit 3f256945f2

View File

@ -738,14 +738,14 @@ err:
return ret;
}
static int parse_threads(struct pstree_item *item, pid_t pid)
static int parse_threads(struct pstree_item *item)
{
struct dirent *de;
DIR *dir;
u32 *t = NULL;
int nr = 1;
dir = opendir_proc(pid, "task");
dir = opendir_proc(item->pid, "task");
if (!dir)
return -1;
@ -876,6 +876,17 @@ err:
return -1;
}
static int collect_threads(struct pstree_item *item)
{
int ret;
ret = parse_threads(item);
if (!ret)
ret = seize_threads(item);
return ret;
}
static struct pstree_item *collect_task(pid_t pid, struct list_head *list)
{
int ret;
@ -909,11 +920,7 @@ static struct pstree_item *collect_task(pid_t pid, struct list_head *list)
item->state = TASK_DEAD;
}
ret = parse_threads(item, pid);
if (ret < 0)
goto err_close;
ret = seize_threads(item);
ret = collect_threads(item);
if (ret < 0)
goto err_close;