On Wed, May 07, 2014 at 12:13:42PM -0700, patrick keshishian wrote:
> On Wed, May 07, 2014 at 02:47:32PM +0100, Dimitris Papastamos wrote:
> > Hi,
> > 
> > This piece of code now uses poll() instead of select().
> > I have not got round to test this yet, but I will as soon as I have
> > a working setup.
> > 
> > Thoughts?
> > 
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/amd/amd/info_hes.c,v
> > retrieving revision 1.13
> > diff -u -p -r1.13 info_hes.c
> > --- info_hes.c      24 Feb 2012 06:19:00 -0000      1.13
> > +++ info_hes.c      7 May 2014 13:38:21 -0000
> > @@ -66,7 +66,7 @@
> >  #endif
> >  
> >  static int soacnt;
> > -static struct timeval hs_timeout;
> > +static int hs_timeout;
> >  static int servernum;
> >  #endif /* HAS_HESIOD_RELOAD */
> >  
> > @@ -261,12 +261,11 @@ hs_res_send(char *buf, int buflen, char 
> >      */
> >     for (retry = _res.retry; retry > 0; retry--) {
> >             for (ns = 0; ns < hs_nscount; ns++) {
> > -                   hs_timeout.tv_sec =
> > -                           (_res.retrans << (_res.retry - retry))
> > -                           / hs_nscount;
> > -                   if (hs_timeout.tv_sec <= 0)
> > -                           hs_timeout.tv_sec = 1;
> > -                   hs_timeout.tv_usec = 0;
> > +                   hs_timeout = _res.retrans << (_res.retry - retry);
> > +                   hs_timeout /= hs_nscount;
> > +                   hs_timeout *= 1000;
> > +                   if (hs_timeout <= 0)
> > +                           hs_timeout = 1000;
> 
> I imagine the values used here are small in scale, but
> I'm not sure. Any concerns of overflow given the new
> code is:
> 
>  - using an int type for calculations and storage vs
>    time_t in the original.
>  - breaking the bit-shift, divide and assign statement
>    into two: a) bit-shift / assign, b) divide / assign.

What about using ppoll() instead?

Reply via email to