X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=lttng-statedump-impl.c;h=c8ac2d12750d210a11a9c375d2cf0f0aed39e189;hb=bba0442a9e5b4460fdfc5bb3ed95f323e52c0909;hp=e9fe829f17bad251a4a985997c011c7acdd2f191;hpb=f0dbdefbdbc26a000ed546180b22144c5b48857d;p=lttng-modules.git diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c index e9fe829f..c8ac2d12 100644 --- a/lttng-statedump-impl.c +++ b/lttng-statedump-impl.c @@ -79,6 +79,7 @@ struct lttng_fd_ctx { char *page; struct lttng_session *session; struct task_struct *p; + struct fdtable *fdt; }; /* @@ -139,6 +140,14 @@ int lttng_enumerate_block_devices(struct lttng_session *session) struct gendisk *disk = dev_to_disk(dev); struct hd_struct *part; + /* + * Don't show empty devices or things that have been + * suppressed + */ + if (get_capacity(disk) == 0 || + (disk->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)) + continue; + disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0); while ((part = disk_part_iter_next(&piter))) { char name_buf[BDEVNAME_SIZE]; @@ -209,18 +218,27 @@ int lttng_dump_one_fd(const void *p, struct file *file, unsigned int fd) { const struct lttng_fd_ctx *ctx = p; const char *s = d_path(&file->f_path, ctx->page, PAGE_SIZE); + unsigned int flags = file->f_flags; + /* + * We don't expose kernel internal flags, only userspace-visible + * flags. + */ + flags &= ~FMODE_NONOTIFY; + if (test_bit(fd, ctx->fdt->close_on_exec)) + flags |= O_CLOEXEC; if (IS_ERR(s)) { struct dentry *dentry = file->f_path.dentry; /* Make sure we give at least some info */ spin_lock(&dentry->d_lock); trace_lttng_statedump_file_descriptor(ctx->session, ctx->p, fd, - dentry->d_name.name); + dentry->d_name.name, flags, file->f_mode); spin_unlock(&dentry->d_lock); goto end; } - trace_lttng_statedump_file_descriptor(ctx->session, ctx->p, fd, s); + trace_lttng_statedump_file_descriptor(ctx->session, ctx->p, fd, s, + flags, file->f_mode); end: return 0; } @@ -232,6 +250,7 @@ void lttng_enumerate_task_fd(struct lttng_session *session, struct lttng_fd_ctx ctx = { .page = tmp, .session = session, .p = p }; task_lock(p); + ctx.fdt = files_fdtable(p->files); lttng_iterate_fd(p->files, 0, lttng_dump_one_fd, &ctx); task_unlock(p); }