From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755972Ab3BUSXZ (ORCPT ); Thu, 21 Feb 2013 13:23:25 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:47268 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756966Ab3BUSXW (ORCPT ); Thu, 21 Feb 2013 13:23:22 -0500 Message-ID: <51266602.7000402@parallels.com> Date: Thu, 21 Feb 2013 22:22:58 +0400 From: Pavel Emelyanov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Michael Kerrisk , Matthew Helsley , linux-api@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH 3/3] posix-timers: Show sigevent info in proc file References: <512665BA.9040802@parallels.com> In-Reply-To: <512665BA.9040802@parallels.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After the "ID:" line there go 1. "signal:" line, that shows signal number and sigval bits; 2. "notify:" line, that shows the timer notification method. The timer entry would looke like this: ID: 123 signal: 14/0000000000b005d0 notify: signal/pid.732 This information is enough to understand ho the timer_create() was called for each particular timer. Signed-off-by: Pavel Emelyanov --- fs/proc/base.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index fc73d19..7f01e19 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2017,6 +2017,7 @@ struct timers_private { struct pid *pid; struct task_struct *task; struct sighand_struct *sighand; + struct pid_namespace *ns; unsigned long flags; }; @@ -2059,9 +2060,24 @@ static void timers_stop(struct seq_file *m, void *v) static int show_timer(struct seq_file *m, void *v) { struct k_itimer *timer; + struct timers_private *tp = m->private; + int notify; + static char *nstr[] = { + [SIGEV_SIGNAL] = "signal", + [SIGEV_NONE] = "none", + [SIGEV_THREAD] = "thread", + }; timer = list_entry((struct list_head *)v, struct k_itimer, list); + notify = timer->it_sigev_notify; + seq_printf(m, "ID: %d\n", timer->it_id); + seq_printf(m, "signal: %d/%p\n", timer->sigq->info.si_signo, + timer->sigq->info.si_value.sival_ptr); + seq_printf(m, "notify: %s/%s.%d\n", + nstr[notify & ~SIGEV_THREAD_ID], + (notify & SIGEV_THREAD_ID) ? "tid" : "pid", + pid_nr_ns(timer->it_pid, tp->ns)); return 0; } @@ -2083,6 +2099,7 @@ static int proc_timers_open(struct inode *inode, struct file *file) return -ENOMEM; tp->pid = proc_pid(inode); + tp->ns = inode->i_sb->s_fs_info; return 0; } -- 1.7.6.5