
From: "Bill Rugolsky Jr." <brugolsky@telemetry-investments.com>

This patch changes select() and poll() to not wait forever when a valid,
but large timeout value is supplied.  The SUSv3 manual page for select(2)
states:

  "If the timeout argument specifies a timeout interval greater than the
  implementation-defined maximum value, the maximum value shall be used as
  the actual timeout value."

Both select() and poll() have a well-defined mechanism to wait forever,
so there is no need for the existing behavior.



---

 25-akpm/fs/select.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN fs/select.c~poll-select-handle-large-timeouts fs/select.c
--- 25/fs/select.c~poll-select-handle-large-timeouts	2004-03-12 01:30:21.000000000 -0800
+++ 25-akpm/fs/select.c	2004-03-12 01:30:21.000000000 -0800
@@ -316,6 +316,8 @@ sys_select(int n, fd_set __user *inp, fd
 		if ((unsigned long) sec < (MAX_SCHEDULE_TIMEOUT-1) / HZ - 1) {
 			timeout = ROUND_UP(usec, 1000000/HZ);
 			timeout += sec * (unsigned long) HZ;
+		} else {
+			timeout = MAX_SCHEDULE_TIMEOUT-1;
 		}
 	}
 
@@ -476,7 +478,7 @@ asmlinkage long sys_poll(struct pollfd _
 			if (seconds <= (MAX_SCHEDULE_TIMEOUT-2) / HZ - 1)
 				timeout += seconds*HZ;
 			else
-				timeout = MAX_SCHEDULE_TIMEOUT;
+				timeout = MAX_SCHEDULE_TIMEOUT-1;
 		}
 	}
 

_
