linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Pavel Emelyanov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	matt.helsley@gmail.com, peterz@infradead.org,
	xemul@parallels.com, tglx@linutronix.de, mtk.manpages@gmail.com
Subject: [tip:timers/core] posix-timers: Show sigevent info in proc file
Date: Wed, 17 Apr 2013 12:56:04 -0700	[thread overview]
Message-ID: <tip-57b8015e07a70301e9ec9f324db1a8b73b5a1e2b@git.kernel.org> (raw)
In-Reply-To: <513DA024.80404@parallels.com>

Commit-ID:  57b8015e07a70301e9ec9f324db1a8b73b5a1e2b
Gitweb:     http://git.kernel.org/tip/57b8015e07a70301e9ec9f324db1a8b73b5a1e2b
Author:     Pavel Emelyanov <xemul@parallels.com>
AuthorDate: Mon, 11 Mar 2013 13:13:08 +0400
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 17 Apr 2013 20:51:01 +0200

posix-timers: Show sigevent info in proc file

Previous patch added proc file to list posix timers created by task.
Expand the information provided in this file by adding info about
notification method, with which timers were created. I.e. 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.

Thus the timer entry would looke like this:

ID: 123
signal: 14/0000000000b005d0
notify: signal/pid.732

This information is enough to understand how timer_create() was called
for each particular timer.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Matthew Helsley <matt.helsley@gmail.com>
Link: http://lkml.kernel.org/r/513DA024.80404@parallels.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 fs/proc/base.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 01def9f..a193086 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2018,6 +2018,7 @@ struct timers_private {
 	struct pid *pid;
 	struct task_struct *task;
 	struct sighand_struct *sighand;
+	struct pid_namespace *ns;
 	unsigned long flags;
 };
 
@@ -2060,9 +2061,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;
 }
@@ -2084,6 +2100,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;
 }
 

  reply	other threads:[~2013-04-17 19:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11  9:11 [PATCH 0/3] posix timers: Extend kernel API to report more info about timers (v3) Pavel Emelyanov
2013-03-11  9:12 ` [PATCH 1/3] posix timers: Allocate timer id per process (v2) Pavel Emelyanov
2013-04-17 19:53   ` [tip:timers/core] posix timers: Allocate timer id per process (v2 ) tip-bot for Pavel Emelyanov
2013-03-11  9:12 ` [PATCH 2/3] posix-timers: Introduce /proc/<pid>/timers file Pavel Emelyanov
2013-04-17 19:54   ` [tip:timers/core] posix-timers: Introduce /proc/PID/timers file tip-bot for Pavel Emelyanov
2013-03-11  9:13 ` [PATCH 3/3] posix-timers: Show sigevent info in proc file Pavel Emelyanov
2013-04-17 19:56   ` tip-bot for Pavel Emelyanov [this message]
2013-03-25 13:32 ` [PATCH 0/3] posix timers: Extend kernel API to report more info about timers (v3) Pavel Emelyanov
2013-04-11 11:56   ` 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=tip-57b8015e07a70301e9ec9f324db1a8b73b5a1e2b@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=matt.helsley@gmail.com \
    --cc=mingo@kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=xemul@parallels.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).