[openib-general] [PATCH] complib/cl_event_wheel.c: In cl_event_wheel_reg, use max 32 bit timeout rather than truncated timeout

Hal Rosenstock halr at voltaire.com
Mon Feb 13 09:05:18 PST 2006


complib/cl_event_wheel.c: In cl_event_wheel_reg, use max 32 bit timeout
rather than truncated timeout when timeout overflows 32 bits

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: complib/cl_event_wheel.c
===================================================================
--- complib/cl_event_wheel.c	(revision 5389)
+++ complib/cl_event_wheel.c	(working copy)
@@ -354,6 +354,7 @@ cl_event_wheel_reg(
 {
   cl_event_wheel_reg_info_t *p_event;
   uint64_t timeout;
+  uint32_t to;
   cl_status_t cl_status = CL_SUCCESS;
   cl_list_item_t *prev_event_list_item;
   cl_map_item_t  *p_map_item;
@@ -428,16 +429,18 @@ cl_event_wheel_reg(
 
     /* The timeout for the cl_timer_start should be given as uint32_t.
        if there is an overflow - warn about it. */
+    to = (uint32_t)timeout;
     if ( timeout > (uint32_t)timeout )
     {
+      to = 0xffffffff; /* max 32 bit timer */
       osm_log (p_event_wheel->p_log, OSM_LOG_INFO,
                "cl_event_wheel_reg: "
-               "timeout requested is too large. Using timeout: %u \n",
-               (uint32_t)timeout );
+               "timeout requested is too large. Using timeout: %u\n",
+               to );
     }
 
     /* start the timer to the timeout [msec] */
-    cl_status = cl_timer_start(&p_event_wheel->timer, (uint32_t)timeout);
+    cl_status = cl_timer_start(&p_event_wheel->timer, to);
     if (cl_status != CL_SUCCESS)
     {
       osm_log (p_event_wheel->p_log, OSM_LOG_ERROR,






More information about the general mailing list