Commit 42bd5163 authored by Pavel Emelyanov's avatar Pavel Emelyanov

files: Print more info about unsupported fd to dump

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 2677006c
...@@ -239,10 +239,10 @@ static int fill_fd_params(struct parasite_ctl *ctl, int fd, int lfd, ...@@ -239,10 +239,10 @@ static int fill_fd_params(struct parasite_ctl *ctl, int fd, int lfd,
return 0; return 0;
} }
static int dump_unsupp_fd(const struct fd_parms *p) static int dump_unsupp_fd(const struct fd_parms *p, char *more, char *info)
{ {
pr_err("Can't dump file %d of that type [%o]\n", pr_err("Can't dump file %d of that type [%o] (%s %s)\n",
p->fd, p->stat.st_mode); p->fd, p->stat.st_mode, more, info);
return -1; return -1;
} }
...@@ -275,8 +275,12 @@ static int dump_chrdev(struct fd_parms *p, int lfd, const int fdinfo) ...@@ -275,8 +275,12 @@ static int dump_chrdev(struct fd_parms *p, int lfd, const int fdinfo)
if (ops) if (ops)
break; break;
/* fallthrough */ /* fallthrough */
default: default: {
return dump_unsupp_fd(p); char more[32];
sprintf(more, "%d:%d", maj, minor(p->stat.st_dev));
return dump_unsupp_fd(p, "chr", more);
}
} }
return do_dump_gen_file(p, lfd, ops, fdinfo); return do_dump_gen_file(p, lfd, ops, fdinfo);
...@@ -320,8 +324,14 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op ...@@ -320,8 +324,14 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
ops = &fanotify_dump_ops; ops = &fanotify_dump_ops;
else if (is_signalfd_link(lfd)) else if (is_signalfd_link(lfd))
ops = &signalfd_dump_ops; ops = &signalfd_dump_ops;
else else {
return dump_unsupp_fd(&p); char more[64];
if (read_fd_link(fd, more, sizeof(more)))
more[0] = '\0';
return dump_unsupp_fd(&p, "anon", more);
}
return do_dump_gen_file(&p, lfd, ops, fdinfo); return do_dump_gen_file(&p, lfd, ops, fdinfo);
} }
...@@ -339,7 +349,7 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op ...@@ -339,7 +349,7 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
if (check_ns_proc(&link)) if (check_ns_proc(&link))
return do_dump_gen_file(&p, lfd, &nsfile_dump_ops, fdinfo); return do_dump_gen_file(&p, lfd, &nsfile_dump_ops, fdinfo);
return dump_unsupp_fd(&p); return dump_unsupp_fd(&p, "reg", link.name + 1);
} }
if (S_ISFIFO(p.stat.st_mode)) { if (S_ISFIFO(p.stat.st_mode)) {
...@@ -351,7 +361,7 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op ...@@ -351,7 +361,7 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
return do_dump_gen_file(&p, lfd, ops, fdinfo); return do_dump_gen_file(&p, lfd, ops, fdinfo);
} }
return dump_unsupp_fd(&p); return dump_unsupp_fd(&p, "unknown", NULL);
} }
int dump_task_files_seized(struct parasite_ctl *ctl, struct pstree_item *item, int dump_task_files_seized(struct parasite_ctl *ctl, struct pstree_item *item,
......
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