patch-2.1.130 linux/kernel/itimer.c

Next file: linux/kernel/ksyms.c
Previous file: linux/kernel/info.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.129/linux/kernel/itimer.c linux/kernel/itimer.c
@@ -6,11 +6,9 @@
 
 /* These are all the functions necessary to implement itimers */
 
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/smp_lock.h>
+#include <linux/interrupt.h>
 
 #include <asm/uaccess.h>
 
@@ -50,15 +48,15 @@
 	case ITIMER_REAL:
 		interval = current->it_real_incr;
 		val = 0;
-		if (del_timer(&current->real_timer)) {
-			unsigned long now = jiffies;
-			val = current->real_timer.expires;
-			add_timer(&current->real_timer);
+		start_bh_atomic();
+		if (timer_pending(&current->real_timer)) {
+			val = current->real_timer.expires - jiffies;
+
 			/* look out for negative/zero itimer.. */
-			if (val <= now)
-				val = now+1;
-			val -= now;
+			if ((long) val <= 0)
+				val = 1;
 		}
+		end_bh_atomic();
 		break;
 	case ITIMER_VIRTUAL:
 		val = current->it_virt_value;
@@ -117,7 +115,9 @@
 		return k;
 	switch (which) {
 		case ITIMER_REAL:
+			start_bh_atomic();
 			del_timer(&current->real_timer);
+			end_bh_atomic();
 			current->it_real_value = j;
 			current->it_real_incr = i;
 			if (!j)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov