Commit 894a626a authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

dump: parse_threads - Pass single struct pstree_item instead of a few parameters

Parsing children will require to know the number
of threads found so in a sake of consistency pass
single struct pstree_item here as well.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 3e45e040
...@@ -701,7 +701,7 @@ err: ...@@ -701,7 +701,7 @@ err:
return ret; return ret;
} }
static int parse_threads(pid_t pid, u32 *nr_threads, u32 **threads) static int parse_threads(pid_t pid, struct pstree_item *item)
{ {
struct dirent *de; struct dirent *de;
DIR *dir; DIR *dir;
...@@ -733,8 +733,9 @@ static int parse_threads(pid_t pid, u32 *nr_threads, u32 **threads) ...@@ -733,8 +733,9 @@ static int parse_threads(pid_t pid, u32 *nr_threads, u32 **threads)
closedir(dir); closedir(dir);
*threads = t; item->threads = t;
*nr_threads = nr - 1; item->nr_threads = nr - 1;
return 0; return 0;
} }
...@@ -793,7 +794,7 @@ static struct pstree_item *find_pstree_entry(pid_t pid) ...@@ -793,7 +794,7 @@ static struct pstree_item *find_pstree_entry(pid_t pid)
if (!item) if (!item)
goto err; goto err;
if (parse_threads(pid, &item->nr_threads, &item->threads)) if (parse_threads(pid, item))
goto err_free; goto err_free;
if (parse_children(pid, &item->nr_children, &item->children)) if (parse_children(pid, &item->nr_children, &item->children))
......
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