All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Matthew Helsley <matt.helsley@gmail.com>,
	linux-api@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/3] posix-timers: Show sigevent info in proc file
Date: Thu, 21 Feb 2013 22:22:58 +0400	[thread overview]
Message-ID: <51266602.7000402@parallels.com> (raw)
In-Reply-To: <512665BA.9040802@parallels.com>

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 <xemul@parallels.com>
---
 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

  parent reply	other threads:[~2013-02-21 18:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-21 18:21 [PATCH 0/3] posix timers: Extend kernel API to report more info about timers (v2) Pavel Emelyanov
2013-02-21 18:22 ` [PATCH 2/3] posix-timers: Introduce /proc/<pid>/timers file Pavel Emelyanov
2013-02-21 18:22 ` Pavel Emelyanov [this message]
     [not found] ` <512665BA.9040802-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-02-21 18:22   ` [PATCH 1/3] posix timers: Allocate timer id per process (v2) Pavel Emelyanov
2013-02-21 18:22     ` Pavel Emelyanov
     [not found]     ` <512665E1.4040800-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-08 12:50       ` Thomas Gleixner
2013-03-08 12:50         ` Thomas Gleixner
2013-03-08  8:40   ` [PATCH 0/3] posix timers: Extend kernel API to report more info about timers (v2) Pavel Emelyanov
2013-03-08  8:40     ` Pavel Emelyanov
     [not found]     ` <5139A409.3040805-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-08  9:56       ` Thomas Gleixner
2013-03-08  9:56         ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2013-03-11  9:11 [PATCH 0/3] posix timers: Extend kernel API to report more info about timers (v3) Pavel Emelyanov
     [not found] ` <513D9FD9.6020507-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-11  9:13   ` [PATCH 3/3] posix-timers: Show sigevent info in proc file Pavel Emelyanov
2013-03-11  9:13     ` Pavel Emelyanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51266602.7000402@parallels.com \
    --to=xemul@parallels.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.helsley@gmail.com \
    --cc=mingo@redhat.com \
    --cc=mtk.manpages@gmail.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.