patch-2.1.127 linux/kernel/signal.c

Next file: linux/kernel/sysctl.c
Previous file: linux/kernel/sched.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.126/linux/kernel/signal.c linux/kernel/signal.c
@@ -712,6 +712,7 @@
 	sigset_t these;
 	struct timespec ts;
 	siginfo_t info;
+	long timeout = 0;
 
 	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset_t))
@@ -738,22 +739,18 @@
 	if (!sig) {
 		/* None ready -- temporarily unblock those we're interested
 		   in so that we'll be awakened when they arrive.  */
-		unsigned long expire;
 		sigset_t oldblocked = current->blocked;
 		sigandsets(&current->blocked, &current->blocked, &these);
 		recalc_sigpending(current);
 		spin_unlock_irq(&current->sigmask_lock);
 
-		expire = ~0UL;
-		if (uts) {
-			expire = (timespec_to_jiffies(&ts)
-				  + (ts.tv_sec || ts.tv_nsec));
-			expire += jiffies;
-		}
-		current->timeout = expire;
+		timeout = MAX_SCHEDULE_TIMEOUT;
+		if (uts)
+			timeout = (timespec_to_jiffies(&ts)
+				   + (ts.tv_sec || ts.tv_nsec));
 
 		current->state = TASK_INTERRUPTIBLE;
-		schedule();
+		timeout = schedule_timeout(timeout);
 
 		spin_lock_irq(&current->sigmask_lock);
 		sig = dequeue_signal(&these, &info);
@@ -770,10 +767,8 @@
 		}
 	} else {
 		ret = -EAGAIN;
-		if (current->timeout != 0) {
-			current->timeout = 0;
+		if (timeout)
 			ret = -EINTR;
-		}
 	}
 
 	return ret;

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