Bug (?) in dahdi

Łukasz Wójcik lukasz.wojcik at zoho.com
Fri Mar 6 11:44:17 UTC 2015


I am currently working on sponsored project to upgrade dahdi to support
some of newer Digium cards (namely TE235). During porting, I've noticed
the following definition (in linux.h):

#define msecs_to_jiffies(msec)	((msec) / 1000 / HZ)

I believe it is a bug. It may introduce some discrete problems
(time-triggered). Unless I'm mistaken, linux' 'jiffies' is the same as
system ticks. Therefore we want to get a number of system ticks that
would 'happen' in 'msec' time. Given equation will always give 0
(rounded to integer), unless msec > 1000* HZ.

I believe that formula should be:

#define msecs_to_jiffies(msec)	((msec) * 1000 / HZ)

But it could also be improved to secure some corner cases, e.g. like this:


Am I missing something, or is it a bug ?


More information about the freebsd-ports mailing list