Skip to content

Commit

Permalink
posix-timers: Show sigevent info in proc file
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pavel Emelyanov authored and Thomas Gleixner committed Apr 17, 2013
1 parent 48f6a7a commit 57b8015
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand Down

0 comments on commit 57b8015

Please sign in to comment.