On 09:06 Thu 13 Aug     , Ira Weiny wrote:
> > > @@ -148,9 +148,11 @@ cl_event_wait_on(IN cl_event_t * const p_event,
> > >   } else {
> > >           /* Get the current time */
> > >           if (gettimeofday(&curtime, NULL) == 0) {
> > > -                 timeout.tv_sec = curtime.tv_sec + (wait_us / 1000000);
> > > -                 timeout.tv_nsec =
> > > -                     (curtime.tv_usec + (wait_us % 1000000)) * 1000;
> > > +                 uint32_t n_sec = (curtime.tv_usec + (wait_us % 1000000))
> > 
> > Do you really need fixed size (uint32_t) variable here?
> 
> Well I need at least int32_t.  I chose unsigned because we are not trying to 
> go back in time.  I don't like leaving this as "int".  As rare as it might 
> be, a compiler could chose 16bits for an int and that is not big enough, 
> right?

Right, but tv_nsec field of struct timespec has 'long' type, not 'int'.

Actually my question was more about using *fixed* size type - I think
that we should avoid using fixed size types in cases when it is not
really needed (such as protocol structures, etc.).

So I'm changing this uint32_t to unsigned long which should be fine.

> From: Ira Weiny <[email protected]>
> Date: Thu, 6 Aug 2009 18:31:46 -0700
> Subject: [PATCH] opensm/complib: account for nsec overflow in timeout values
> 
> 
> Signed-off-by: Ira Weiny <[email protected]>

Applied. Thanks.

Sasha
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to