[patch] fix alarm() return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  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 <[email protected]>
I'm the hacker formerly known as Gerd Knorr.
http://www.suse.de/~kraxel/just-married.jpeg
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);

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux