[Dnsmasq-discuss] (no subject)

Jan 'RedBully' Seiffert redbully at cc.fh-luh.de
Tue Feb 13 18:12:05 GMT 2007


mmarkk wrote:
> 
> Il giorno 13/feb/07, alle ore 10:58, Simon Kelley ha scritto:
> 
> 
> 
>> There's no way to increase verbosity which would be useful here, since
>> you can build new binaries, I guess adding old-fashioned printf is the
>> way to debug. The code you are interested in in src/dnsmasq.c, lines
>> 521-570.
> 
> ok, I realized that the problem depend in some way from difftime function.
> Without changes, the function seems not to return a number (it returns
> nan), and the resolv.conf file is not read
> 
> I have made this change:
> 
> (int)difftime(now, last)
> 
> and also
> 
> int intdiff;
> intdiff=difftime(...);
> 

Casting the NaN representation to int wouldn't work. (or you're looking
at garbage, since the ABI is messed up)
Hmmmm, ugly hack alarm, directly from the man page:

> NAME
>        difftime - calculate time difference
...
> CONFORMING TO
>        SVr4, 4.3BSD, C99
> 
> NOTES
>        On a POSIX system, time_t is an arithmetic type, and one could just define
> 
>               #define difftime(t1,t0) (double)(t1 - t0)
> 
>        when  the  possible  overflow  in the subtraction is not a concern.  On other systems, the data type time_t might use
>        some other encoding where subtraction doesn't work directly.

So, dropping the cast to double, you can maybe get away with this.
(besides you also have to change the comparisons against floating point
types)

hmmm, or not? Rules of implicit type conversion...
Is the difftime result casted to an int or the int casted to a double:
Good?
> ./src/rfc2131.c:976:  else if (lease && lease->expires != 0 && difftime(lease->expires, now) > 0.0)
Bad?
> ./src/lease.c:251:      if ((lease->expires != 0 && difftime(now, lease->expires) > 0) || lease == target)

Simon?

[snip]
> 
> maybe all of this is because my processor does not handle floating point?
> 
In this case, you should have some soft-float, as Simon mentioned, on
the compiler line (and better compiled your libc and system this way),
to ensure that the ABI matches. If everything is "done right", you
shouldn't have to bother (besides that it is slow, because the compiler
will inserts emulation code). Your compiler should have something like
that in it's spec-file (assuming it's gcc), so this setting becomes the
default.
On the other hand your cpu should signal (to the OS, finaly to you,
sigill, sigsegv, sigfpe etc.) if there's no fpu and it runs about
fpu-instructions. (Or there's OS-level fpu-emulation)


> 
> cheers
> 
> mmarkk
> 
Greetings
	Jan


-- 
H.323 has much in common with other ITU-T standards - it features a
complex binary wire protocol, a nightmarish implementation, and a bulk
that can be used to fell medium-to-large predatory animals.
        -- Anthony Baxter



More information about the Dnsmasq-discuss mailing list