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:
parent
3ab9285f0f
commit
3f256945f2
21
cr-dump.c
21
cr-dump.c
@ -738,14 +738,14 @@ err:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_threads(struct pstree_item *item, pid_t pid)
|
static int parse_threads(struct pstree_item *item)
|
||||||
{
|
{
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
u32 *t = NULL;
|
u32 *t = NULL;
|
||||||
int nr = 1;
|
int nr = 1;
|
||||||
|
|
||||||
dir = opendir_proc(pid, "task");
|
dir = opendir_proc(item->pid, "task");
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -876,6 +876,17 @@ err:
|
|||||||
return -1;
|
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)
|
static struct pstree_item *collect_task(pid_t pid, struct list_head *list)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -909,11 +920,7 @@ static struct pstree_item *collect_task(pid_t pid, struct list_head *list)
|
|||||||
item->state = TASK_DEAD;
|
item->state = TASK_DEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = parse_threads(item, pid);
|
ret = collect_threads(item);
|
||||||
if (ret < 0)
|
|
||||||
goto err_close;
|
|
||||||
|
|
||||||
ret = seize_threads(item);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err_close;
|
goto err_close;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user