Commit 12147a0c authored by Pavel Emelyanov's avatar Pavel Emelyanov

show: Fix and clean cr_show_all

Don't allocate fdset to show sk queues and don't fail on pstree
fd opening :)
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7eb37486
...@@ -558,34 +558,36 @@ err: ...@@ -558,34 +558,36 @@ err:
static int cr_show_all(unsigned long pid, struct cr_options *opts) static int cr_show_all(unsigned long pid, struct cr_options *opts)
{ {
struct cr_fdset *cr_fdset = NULL;
struct pstree_item *item = NULL; struct pstree_item *item = NULL;
LIST_HEAD(pstree_list); LIST_HEAD(pstree_list);
int i, ret = -1, pstree_fd; int i, ret = -1, fd;
pstree_fd = open_image_ro(CR_FD_PSTREE); fd = open_image_ro(CR_FD_PSTREE);
if (pstree_fd) if (fd < 0)
goto out; goto out;
ret = show_pstree(pstree_fd, &pstree_list); ret = show_pstree(fd, &pstree_list);
if (ret) if (ret)
goto out; goto out;
cr_fdset = cr_show_fdset_open(pid, CR_FD_DESC_SK_QUEUES); close(fd);
if (!cr_fdset)
fd = open_image_ro(CR_FD_DESC_SK_QUEUES, pid);
if (fd < 0)
goto out; goto out;
ret = show_sk_queues(cr_fdset->fds[CR_FD_SK_QUEUES]); ret = show_sk_queues(fd);
if (ret) if (ret)
goto out; goto out;
close_cr_fdset(&cr_fdset); close(fd);
ret = try_show_namespaces(pid); ret = try_show_namespaces(pid);
if (ret) if (ret)
goto out; goto out;
list_for_each_entry(item, &pstree_list, list) { list_for_each_entry(item, &pstree_list, list) {
struct cr_fdset *cr_fdset = NULL;
cr_fdset = cr_show_fdset_open(item->pid, CR_FD_DESC_TASK); cr_fdset = cr_show_fdset_open(item->pid, CR_FD_DESC_TASK);
if (!cr_fdset) if (!cr_fdset)
...@@ -642,7 +644,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts) ...@@ -642,7 +644,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
out: out:
free_pstree(&pstree_list); free_pstree(&pstree_list);
close_cr_fdset(&cr_fdset);
return ret; return ret;
} }
......
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