Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/kern Pull up rev. 1.49:



details:   https://anonhg.NetBSD.org/src/rev/ffa93b5f1c3e
branches:  netbsd-1-5
changeset: 488484:ffa93b5f1c3e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jul 13 01:39:02 2000 +0000

description:
Pull up rev. 1.49:
When select(2)/poll(2) is awakened by a collision, recalculate the
timeout value for tsleep().  From Artur Grabowski <art%stacken.kth.se@localhost>.

diffstat:

 sys/kern/sys_generic.c |  38 +++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 21 deletions(-)

diffs (75 lines):

diff -r 8e7cc028a7f1 -r ffa93b5f1c3e sys/kern/sys_generic.c
--- a/sys/kern/sys_generic.c    Thu Jul 13 01:14:08 2000 +0000
+++ b/sys/kern/sys_generic.c    Thu Jul 13 01:39:02 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_generic.c,v 1.48 2000/05/27 00:40:47 sommerfeld Exp $      */
+/*     $NetBSD: sys_generic.c,v 1.48.4.1 2000/07/13 01:39:02 thorpej Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -707,12 +707,6 @@
                }
                s = splclock();
                timeradd(&atv, &time, &atv);
-               timo = hzto(&atv);
-               /*
-                * Avoid inadvertently sleeping forever.
-                */
-               if (timo == 0)
-                       timo = 1;
                splx(s);
        } else
                timo = 0;
@@ -723,11 +717,15 @@
                           (fd_mask *)(bits + ni * 3), SCARG(uap, nd), retval);
        if (error || *retval)
                goto done;
+       if (SCARG(uap, tv)) {
+               /*
+                * We have to recalculate the timeout on every retry.
+                */
+               timo = hzto(&atv);
+               if (timo <= 0)
+                       goto done;
+       }
        s = splhigh();
-       if (timo && timercmp(&time, &atv, >=)) {
-               splx(s);
-               goto done;
-       }
        if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) {
                splx(s);
                goto retry;
@@ -845,12 +843,6 @@
                }
                s = splclock();
                timeradd(&atv, &time, &atv);
-               timo = hzto(&atv);
-               /*
-                * Avoid inadvertently sleeping forever.
-                */
-               if (timo == 0)
-                       timo = 1;
                splx(s);
        } else
                timo = 0;
@@ -860,11 +852,15 @@
        error = pollscan(p, (struct pollfd *)bits, SCARG(uap, nfds), retval);
        if (error || *retval)
                goto done;
+       if (SCARG(uap, timeout) != INFTIM) {
+               /*
+                * We have to recalculate the timeout on every retry.
+                */
+               timo = hzto(&atv);
+               if (timo <= 0)
+                       goto done;
+       }
        s = splhigh();
-       if (timo && timercmp(&time, &atv, >=)) {
-               splx(s);
-               goto done;
-       }
        if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) {
                splx(s);
                goto retry;



Home | Main Index | Thread Index | Old Index