xserver: Branch 'master' - 2 commits

Keith Packard keithp at kemper.freedesktop.org
Mon Feb 24 16:29:09 PST 2014


 Xext/sync.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

New commits:
commit 1940508a4af33d44a7a8ef24bbdcd1e31e228dab
Merge: c85ea92 ddeca92
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Feb 24 16:27:52 2014 -0800

    Merge remote-tracking branch 'herrb/master'

commit ddeca927498c9df3b5e62c7bf05e31e2a3aeaa52
Author: Mark Kettenis <kettenis at openbsd.org>
Date:   Sun Dec 15 14:31:10 2013 +0100

    sync: Avoid ridiculously long timeouts
    
    On OpenBSD, passing a timeout longer than 100000000 seconds to select(2) will
    make it fail with EINVAL.  As this is original 4.4BSD behaviour it is not
    inconceivable that other systems suffer from the same problem.  And Linux,
    though not suffering from any 4.4BSD heritage, briefly did something similar:
    
    <https://lkml.org/lkml/2012/8/31/263>
    
    So avoid calling AdjustWaitForDelay() instead of setting the timeout to
    (effectively) ULONG_MAX milliseconds.
    
    Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
    Reviewed-by: Matthieu Herrb <matthieu at herrb.eu>

diff --git a/Xext/sync.c b/Xext/sync.c
index 97c9d51..755ed94 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2731,27 +2731,24 @@ IdleTimeBlockHandler(void *pCounter, struct timeval **wt, void *LastSelectMask)
          * If we've been idle more than it, and someone wants to know about
          * that level-triggered, schedule an immediate wakeup.
          */
-        unsigned long timeout = -1;
 
         if (XSyncValueLessThan(idle, *greater)) {
             XSyncValue value;
             Bool overflow;
 
             XSyncValueSubtract(&value, *greater, idle, &overflow);
-            timeout = min(timeout, XSyncValueLow32(value));
+            AdjustWaitForDelay(wt, XSyncValueLow32(value));
         }
         else {
             for (list = counter->sync.pTriglist; list;
                  list = list->next) {
                 trig = list->pTrigger;
                 if (trig->CheckTrigger(trig, old_idle)) {
-                    timeout = min(timeout, 0);
+                    AdjustWaitForDelay(wt, 0);
                     break;
                 }
             }
         }
-
-        AdjustWaitForDelay(wt, timeout);
     }
 
     counter->value = old_idle;  /* pop */


More information about the xorg-commit mailing list