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

john stultz-lkml johnstul.lkml at gmail.com
Thu Aug 27 23:42:50 UTC 2009


On Sat, Aug 22, 2009 at 2:38 PM, Hal Murray<hmurray at megapathdsl.net> wrote:
> 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

Thanks for the heads up. I'll see about pushing a fix into mainline
shortly, and we'll have to also try to get the glibc headers fixed up
as well.

Likely this fell out from the comment above the , as the MOD_* definitions:
/* xntp 3.4 compatibility names */

Which makes it seem like the MOD_ values were legacy constants. I'm
guessing that comment needs to be scratched.

thanks
-john


More information about the hackers mailing list