[openib-general] [PATCH] uDAPL dapl_os_wait_object_wait()

Arlin Davis arlin.r.davis at intel.com
Mon Jul 25 15:20:29 PDT 2005


James,

Here is a patch to fix dapl_os_wait_object_wait() returning 
EINVAL when passing nsec == 1000000000 to pthread_cond_timedwait(). 
Hit a rare case where _microsecs was exactly 1000000.

Thanks,

-arlin

Signed-off by: Arlin Davis <ardavis at ichips.intel.com>

Index: dapl/udapl/linux/dapl_osd.c
===================================================================
--- dapl/udapl/linux/dapl_osd.c (revision 2899)
+++ dapl/udapl/linux/dapl_osd.c (working copy)
@@ -242,16 +242,9 @@

        gettimeofday (&now, &tz);
        microsecs = now.tv_usec + (timeout_val % 1000000);
-       if (microsecs > 1000000)
-       {
-           now.tv_sec = now.tv_sec + timeout_val / 1000000 + 1;
-           now.tv_usec = microsecs - 1000000;
-       }
-       else
-       {
-           now.tv_sec = now.tv_sec + timeout_val / 1000000;
-           now.tv_usec = microsecs;
-       }
+
+       now.tv_sec = now.tv_sec + timeout_val/1000000 + (microsecs/1000000);
+       now.tv_usec = microsecs % 1000000;

        /* Convert timeval to timespec */
        future.tv_sec = now.tv_sec;





More information about the general mailing list