[ntp:hackers] Compiler/config troubles: MOD_NANO on Fedora 11

Hal Murray hmurray at megapathdsl.net
Sat Aug 22 21:38:00 UTC 2009


Am I really the first person to try building ntpd on Fedora 11?  That seems 
unlikely, so how are others getting around this problem?  Did I fatfinger 
something on the update?  (That's quite possible.)


I updated a system from Fedora 10 to Fedora 11.

Trying to compile ntpd gets this error:

ntp_loopfilter.c: In function local_clock:
ntp_loopfilter.c:521: error: MOD_NANO undeclared (first use in this function)

The source code looks like this:

#ifdef STA_NANO
                        ntv.modes = MOD_BITS | MOD_NANO;
#else /* STA_NANO */
                        ntv.modes = MOD_BITS;
#endif /* STA_NANO */


There are no interesting changes in config.h  I think I've tracked the 
problem back to changes in the kernel header files.

Neither the old nor new headers defines MOD_NANO.  grepping for STA_NANO gets 
interesting:

sys/timex.h gets included by include/ntp_syscall.h which is used by 
ntp_loopfilter.c (and several other modules)

new:
/usr/include/linux/timex.h:#define STA_NANO     0x2000  /* resolution (0 = 
us, 1
= ns) (ro) */
/usr/include/linux/timex.h:     STA_PPSERROR | STA_CLOCKERR | STA_NANO | 
STA_MODE | STA_CLK)
/usr/include/sys/timex.h:#define STA_NANO       0x2000  /* resolution (0 = 
us, 1
= ns) (ro) */

old:
/mnt/daily/01/usr/include/linux/timex.h:#define STA_NANO        0x2000  /* 
resolution (0 = us, 1 = ns) (ro) */
/mnt/daily/01/usr/include/linux/timex.h:        STA_PPSERROR | STA_CLOCKERR | 
STA_NANO | STA_MODE | STA_CLK)

So the new systeem has a sys/timex.h which defines STA_NANO where the old one 
didn't.  That at least explains why the old system worked.

But the new system doesn't define MOD_NANO.

It looks like somebody didn't like the MOD_xxx names and "fixed" them to be 
ADJ_xxx

The new sys/timex.h says:
/* xntp 3.4 compatibility names */
#define MOD_OFFSET      ADJ_OFFSET
#define MOD_FREQUENCY   ADJ_FREQUENCY
#define MOD_MAXERROR    ADJ_MAXERROR
#define MOD_ESTERROR    ADJ_ESTERROR
#define MOD_STATUS      ADJ_STATUS
#define MOD_TIMECONST   ADJ_TIMECONST
#define MOD_CLKB        ADJ_TICK
#define MOD_CLKA        ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */

but MOD_NANO fell through the cracks.


I propose the following fix to ntp_syscall.h.  Is there a better way?  Is 
anybody plugged in to the Linux kernel guys?


#ifdef HAVE_SYS_TIMEX_H
# include <sys/timex.h>
#if defined(ADJ_NANO) && !defined(MOD_NANO)
/* bug in Linux header files */
# define MOD_NANO ADJ_NANO
#endif
#endif






-- 
These are my opinions, not necessarily my employer's.  I hate spam.





More information about the hackers mailing list