Subject: Re: pthread_create and timer_settime
To: Herb Peyerl <hpeyerl@beer.org>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-userlevel
Date: 04/18/2005 19:51:36
Herb Peyerl <hpeyerl@beer.org> writes:

> int
> itimerfix(struct timeval *tv)
> {
> 
>          if (tv->tv_sec < 0 || tv->tv_usec < 0 || tv->tv_usec >= 1000000)
>                  return (EINVAL);
>          if (tv->tv_sec == 0 && tv->tv_usec != 0 && tv->tv_usec < tick)
>                  tv->tv_usec = tick;
>          return (0);
> }
> 
> 
> So itimerfix() is getting 100000 which is less than 1000000.  But I
> already know from this printf() I put in sys_timer_settime():
> 
>          if (itimerfix(&val.it_value) || itimerfix(&val.it_interval)) {
>                  // 3: 16 0
>                  printf("3: %x %x\n", itimerfix(&val.it_value),
> itimerfix(&val.it_interval));
>                  return (EINVAL);
>          }
> 
> that itimerfix(&val.it_value) is returning EINVAL.

Okay, the itimerfix() call is returning EINVAL. Can you make it print
the actual values of val->tv_sec and val->tv_usec in that case? It
sounds like you've ruled out tv_usec being too large, but I don't see
anything about the value that tv_sec has. Printing out the
value->tv_sec and value->tv_nsec while you're at it would be nice,
too, in case there's some kind of conversion screwiness.

(FWIW, ntop from pkgsrc seems to work on -current/i386, so I'm not
immediately able to reproduce this problem...)

        - Nathan