From: Cyrill Gorcunov Date: Thu, 29 Nov 2012 03:19:18 +0000 (+1100) Subject: fdinfo: show sigmask for signalfd fd X-Git-Tag: next-20121205~1^2~11 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=473197834610c538467d599a12419e046109ef73;p=karo-tx-linux.git fdinfo: show sigmask for signalfd fd The sigmask is read in lockless manner for a sake of code simplicity, thus if precise data needed here the tasks which refer to the signalfd should be stopped before read. Signed-off-by: Cyrill Gorcunov Acked-by: Pavel Emelyanov Cc: Oleg Nesterov Cc: Andrey Vagin Cc: Al Viro Cc: Alexey Dobriyan Cc: James Bottomley Cc: "Aneesh Kumar K.V" Cc: Alexey Dobriyan Cc: Matthew Helsley Cc: "J. Bruce Fields" Cc: "Aneesh Kumar K.V" Cc: Tvrtko Ursulin Signed-off-by: Andrew Morton --- diff --git a/fs/proc/array.c b/fs/proc/array.c index 7f7111796ea2..6a91e6ffbcbd 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -220,7 +220,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, seq_putc(m, '\n'); } -static void render_sigset_t(struct seq_file *m, const char *header, +void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set) { int i; 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 @@ #include #include #include +#include void signalfd_cleanup(struct sighand_struct *sighand) { @@ -227,7 +228,24 @@ static ssize_t signalfd_read(struct file *file, char __user *buf, size_t count, return total ? total: ret; } +#ifdef CONFIG_PROC_FS +static int signalfd_show_fdinfo(struct seq_file *m, struct file *f) +{ + struct signalfd_ctx *ctx = f->private_data; + sigset_t sigmask; + + sigmask = ctx->sigmask; + signotset(&sigmask); + render_sigset_t(m, "sigmask:\t", &sigmask); + + return 0; +} +#endif + static const struct file_operations signalfd_fops = { +#ifdef CONFIG_PROC_FS + .show_fdinfo = signalfd_show_fdinfo, +#endif .release = signalfd_release, .poll = signalfd_poll, .read = signalfd_read, diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 2e24018b7cec..32676b35d2f5 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -314,4 +314,7 @@ static inline struct net *PDE_NET(struct proc_dir_entry *pde) return pde->parent->data; } +#include + +void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set); #endif /* _LINUX_PROC_FS_H */