diff options
author | Cyrill Gorcunov <gorcunov@openvz.org> | 2012-12-17 19:05:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 20:15:27 -0500 |
commit | 138d22b58696c506799f8de759804083ff9effae (patch) | |
tree | 4c2af24ab90ececcfd30693cb6e17ab60e30bb86 /fs/signalfd.c | |
parent | cbac5542d48127b546a23d816380a7926eee1c25 (diff) |
fs, epoll: add procfs fdinfo helper
This allows us to print out eventpoll target file descriptor, events and
data, the /proc/pid/fdinfo/fd consists of
| pos: 0
| flags: 02
| tfd: 5 events: 1d data: ffffffffffffffff enabled: 1
[avagin@: fix for unitialized ret variable]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrey Vagin <avagin@openvz.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: James Bottomley <jbottomley@parallels.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Matthew Helsley <matt.helsley@gmail.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/signalfd.c')
-rw-r--r-- | fs/signalfd.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/signalfd.c b/fs/signalfd.c index 8bee4e570911..b53486961735 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/anon_inodes.h> | 29 | #include <linux/anon_inodes.h> |
30 | #include <linux/signalfd.h> | 30 | #include <linux/signalfd.h> |
31 | #include <linux/syscalls.h> | 31 | #include <linux/syscalls.h> |
32 | #include <linux/proc_fs.h> | ||
32 | 33 | ||
33 | void signalfd_cleanup(struct sighand_struct *sighand) | 34 | void signalfd_cleanup(struct sighand_struct *sighand) |
34 | { | 35 | { |
@@ -227,7 +228,24 @@ static ssize_t signalfd_read(struct file *file, char __user *buf, size_t count, | |||
227 | return total ? total: ret; | 228 | return total ? total: ret; |
228 | } | 229 | } |
229 | 230 | ||
231 | #ifdef CONFIG_PROC_FS | ||
232 | static int signalfd_show_fdinfo(struct seq_file *m, struct file *f) | ||
233 | { | ||
234 | struct signalfd_ctx *ctx = f->private_data; | ||
235 | sigset_t sigmask; | ||
236 | |||
237 | sigmask = ctx->sigmask; | ||
238 | signotset(&sigmask); | ||
239 | render_sigset_t(m, "sigmask:\t", &sigmask); | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | #endif | ||
244 | |||
230 | static const struct file_operations signalfd_fops = { | 245 | static const struct file_operations signalfd_fops = { |
246 | #ifdef CONFIG_PROC_FS | ||
247 | .show_fdinfo = signalfd_show_fdinfo, | ||
248 | #endif | ||
231 | .release = signalfd_release, | 249 | .release = signalfd_release, |
232 | .poll = signalfd_poll, | 250 | .poll = signalfd_poll, |
233 | .read = signalfd_read, | 251 | .read = signalfd_read, |