* [PATCH][2/4] poll()/select() timeout behavior
@ 2004-02-20 21:02 Bill Rugolsky Jr.
2004-02-21 3:58 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Bill Rugolsky Jr. @ 2004-02-20 21:02 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-kernel, brugolsky
This patch cause select() to return EINVAL when passed an un-normalized
timeval usec, and fixes up the range check in preparation for the patch
that follows.
Please apply.
Bill Rugolsky
--- linux/fs/select.c 2004-02-20 14:22:53.641191351 -0500
+++ linux/fs/select.c 2004-02-20 14:23:01.891295743 -0500
@@ -291,8 +291,6 @@
* Update: ERESTARTSYS breaks at least the xview clock binary, so
* I'm trying ERESTARTNOHAND which restart only when you want to.
*/
-#define MAX_SELECT_SECONDS \
- ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
asmlinkage long
sys_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp)
@@ -312,10 +310,10 @@
goto out_nofds;
ret = -EINVAL;
- if (sec < 0 || usec < 0)
+ if (sec < 0 || usec < 0 || usec >= 1000000)
goto out_nofds;
- if ((unsigned long) sec < MAX_SELECT_SECONDS) {
+ if ((unsigned long) sec < (MAX_SCHEDULE_TIMEOUT-1) / HZ - 1) {
timeout = ROUND_UP(usec, 1000000/HZ);
timeout += sec * (unsigned long) HZ;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][2/4] poll()/select() timeout behavior
2004-02-20 21:02 [PATCH][2/4] poll()/select() timeout behavior Bill Rugolsky Jr.
@ 2004-02-21 3:58 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2004-02-21 3:58 UTC (permalink / raw)
To: Bill Rugolsky Jr.; +Cc: torvalds, linux-kernel, brugolsky
"Bill Rugolsky Jr." <brugolsky@telemetry-investments.com> wrote:
>
> This patch cause select() to return EINVAL when passed an un-normalized
> timeval usec
Why? The current behaviour is to do the right thing when passed a tv_usec
which is greater than 1,000,000. Why not retain that?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-21 3:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-20 21:02 [PATCH][2/4] poll()/select() timeout behavior Bill Rugolsky Jr.
2004-02-21 3:58 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®