Re: Jiffies Wraparound (was Re: interrupt counts)

Eric Schenk (
Wed, 21 Aug 1996 21:37:32 -0400

Ok, this suggestion _may_ be the product of too much caffine and not enough
sleep, but here it goes anway.

If we really want to catch all the bad code that treats
jiffies as a numeric type and does direct comparisons against them,
or otherwise treats them in unkind ways, why not make the compiler
do the work for us. Declare jiffies to have a type that is the same
size as the current type, but that does not support arithmetic operations,

struct {
unsigned int data;
} JiffieType;

Now, we just need to define a few suitable macros to allow the operations
we do need, and allow them in a safe manner. There should be no loss of
speed in the compiled code. Then it's just a matter of a few weeks of
work on someones part to track down all the places the compiler complains
about this... Of course this doesn't help with comparisions
between time values that have been stored in different variables,
but the same principle could be applied to this problem.

-- eric

Who is not volunteering to do the job, except maybe for checking
the TCP/IP layer for problems like this...