mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] fix alarm() return value
@ 2006-01-30  8:57 Gerd Hoffmann
  2006-01-30  9:07 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2006-01-30  8:57 UTC (permalink / raw)
  To: linux kernel mailing list; +Cc: Thomas Gleixner

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

  Hi folks,

This patch fixes the alarm() system call return value.  The alarm(2)
syscall is supposed to return the reamining seconds.  The hrtimer
switchover broke this because the code tries to gather the remaining
time _after_ canceling the timer.  Trivial fix below.

Please apply,

  Gerd

-- 
Gerd 'just married' Hoffmann <kraxel@suse.de>
I'm the hacker formerly known as Gerd Knorr.
http://www.suse.de/~kraxel/just-married.jpeg

[-- Attachment #2: fix-146142 --]
[-- Type: text/plain, Size: 707 bytes --]

Index: linux-2.6.15/kernel/itimer.c
===================================================================
--- linux-2.6.15.orig/kernel/itimer.c	2006-01-27 16:11:33.000000000 +0100
+++ linux-2.6.15/kernel/itimer.c	2006-01-27 17:01:54.000000000 +0100
@@ -151,12 +151,12 @@ int do_setitimer(int which, struct itime
 	switch (which) {
 	case ITIMER_REAL:
 		timer = &tsk->signal->real_timer;
-		hrtimer_cancel(timer);
 		if (ovalue) {
 			ovalue->it_value = itimer_get_remtime(timer);
 			ovalue->it_interval
 				= ktime_to_timeval(tsk->signal->it_real_incr);
 		}
+		hrtimer_cancel(timer);
 		tsk->signal->it_real_incr =
 			timeval_to_ktime(value->it_interval);
 		expires = timeval_to_ktime(value->it_value);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] fix alarm() return value
  2006-01-30  8:57 [patch] fix alarm() return value Gerd Hoffmann
@ 2006-01-30  9:07 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2006-01-30  9:07 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: linux kernel mailing list, Andrew Morton

On Mon, 2006-01-30 at 09:57 +0100, Gerd Hoffmann wrote:
>   Hi folks,
> 
> This patch fixes the alarm() system call return value.  The alarm(2)
> syscall is supposed to return the reamining seconds.  The hrtimer
> switchover broke this because the code tries to gather the remaining
> time _after_ canceling the timer.  Trivial fix below.

Thanks. The fix is already in -mm and scheduled to go into 2.6.16

	tglx





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-30  9:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-30  8:57 [patch] fix alarm() return value Gerd Hoffmann
2006-01-30  9:07 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome