Skip to content

Commit

Permalink
signals: make siginfo_t si_utime + si_sstime report times in USER_HZ,…
Browse files Browse the repository at this point in the history
… not HZ

In the switch to configurable HZ in 2.6, the treatment of the si_utime and
si_stime fields that are exposed to userland via the siginfo structure
looks to have been botched.  As things stand, these fields report times in
units of HZ, so that userland gets information that varies depending on
the HZ that the kernel was configured with.  This patch changes the
reported values to use USER_HZ units.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Michael Kerrisk authored and Linus Torvalds committed Jul 25, 2008
1 parent e4901f9 commit d8878ba
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1370,10 +1370,9 @@ void do_notify_parent(struct task_struct *tsk, int sig)

info.si_uid = tsk->uid;

/* FIXME: find out whether or not this is supposed to be c*time. */
info.si_utime = cputime_to_jiffies(cputime_add(tsk->utime,
info.si_utime = cputime_to_clock_t(cputime_add(tsk->utime,
tsk->signal->utime));
info.si_stime = cputime_to_jiffies(cputime_add(tsk->stime,
info.si_stime = cputime_to_clock_t(cputime_add(tsk->stime,
tsk->signal->stime));

info.si_status = tsk->exit_code & 0x7f;
Expand Down Expand Up @@ -1441,9 +1440,8 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, int why)

info.si_uid = tsk->uid;

/* FIXME: find out whether or not this is supposed to be c*time. */
info.si_utime = cputime_to_jiffies(tsk->utime);
info.si_stime = cputime_to_jiffies(tsk->stime);
info.si_utime = cputime_to_clock_t(tsk->utime);
info.si_stime = cputime_to_clock_t(tsk->stime);

info.si_code = why;
switch (why) {
Expand Down

0 comments on commit d8878ba

Please sign in to comment.