[ntp:hackers] Re: refclock_atom.c

David L. Mills mills at udel.edu
Mon Dec 13 20:26:37 PST 2004


The entire functionality of the PPSAPI is contained entirely in the 
/usr/include/sys/timepps.h header file specific to each operating 
system. All machine dependencies, including Solaris idiosycnrcies, are 
contained there. The files on some machnines do change from time to time 
and I just had a runin with something broken on Solaris. To wit, only 
the assert and clear bits can be set; nothing else in the mode word, 
even though some combinations would work.

The PPSAPI was specifically designed to be non-NTP centric and we had a 
lot of discussion on alternative uses for it. The intent was to put 
timepps.h in /usr/include/sys, because that's where machine dependencies 
live. Putting it anywhere else is not a good idea. If some OS 
distributes it otherwise, we should so advise the kernelmongers.

Actually, the right place for these files is with the kernel 
distribution for each system, not the NTP distribution. If crafted files 
happen not to be available and they happen to be available at ISC 
separately or in a carefully quarantined directory in the NTP 
distribution as <<models>> for the real stuff, then stash them with a 
readme and note in the build documentation, like OpenSSH is now. In a 
final bit of pique, may I strongly suggest that all header files live in 

This distribution is gettting out of hand. It is full of nasty little 
surprises that either don't work anymore or are spurious to the intended 
use. There are a number of things that should live in their own little 
grotto, like sntp, electric fence, the ancient stuff in sys, old broken 
scripts, etc. I've been sorely bitten by the low-level system clock 
briar patch that I spent quite a lot of time fixing, rationalizing and 
clearing weeds only now to see it botched up beyond any hope of my 
maintenance. Same thing happened to the audio code. This is very, very 
wrong. If some systems require substantially different code, then there 
should be either hidden in a specific header file like timepps.h, be a 
separate module surrounded by ifdefs or a separate file. As it is, the 
maze of ifdefs is impossible to unravel. I don't want the atom driver or 
any other code to get that bad.

I mentioned before that the refclocks local, arbiter, chu, as2201, irig, 
wwv, wwvb, pst, atom, heath and tpro, as well as ntp_refclock.c are from 
my hand. I am not the maintainer, backup maintainer or substitute 
maintainer. I am the ONLY maintainer. If somebody wants to change one of 
those, I would be happy to receive advise, bugs or consideration.

Mark, the atom driver should be fixed. However, I have no way to test in 

Did I mention the current distribution does not compile on porkypine?


Harlan Stenn wrote:

>I've added hackers@ to this thread.
>Here's the history:
>At one time, we noted we could find timepps.h in either /usr/include or
>/usr/include/sys .
>Therefore we support both locations.  The code to do that is:
> #ifdef HAVE_PPSAPI
> # ifdef HAVE_TIMEPPS_H
> #  include <timepps.h>
> # else
> #   include <sys/timepps.h>
> #  endif /* HAVE_SYS_TIMEPPS_H */
> # endif /* HAVE_TIMEPPS_H */
> #endif /* HAVE_PPSAPI */
>Then, somebody noticed that we provide timepps.h files for SunOS, Solaris,
>and SCO.
>On the appropriate OS, the particular file is, as I understand it, designed
>to be installed as-is into /usr/include/sys/timepps.h .  IS THIS TRUE?
>Therefore, this person (I don't know who had this idea) decided that:
>- if we HAVE_TIMEPPS_H or HAVE_SYS_TIMEPPS_H then use them and all is well.
>- else if we are on SunOS we can use timepps-SunOS.h and then we HAVE_PPSAPI.
>- else if we are on Solaris we can use timepps-Solaris.h and we HAVE_PPSAPI.
>- else if we are on SCO we can use timepps-SCO.h and we HAVE_PPSAPI.
>and therefore, on those OSes there is no functional difference between:
>- installing include/timepps-OS.h as /usr/include/sys/timepps.h and
>  getting /usr/include/sys/timepps.h, and
>- getting include/timepps-OS.h
>and therefore we can change the above header inclusion mess to be:
> #ifdef HAVE_PPSAPI
> # ifdef HAVE_TIMEPPS_H
> #  include <timepps.h>
> # else
> #   include <sys/timepps.h>
> #  else /* not HAVE_SYS_TIMEPPS_H */
> #   ifdef TheSunOsThingWeNeed
> #    include "timepps-SunOS.h"
> #    define HAVE_PPSAPI 1
> #   else /* not SunOs */
> #    ifdef TheSolarisThingWeNeed
> #     include "timepps-Solaris.h"
> #     define HAVE_PPSAPI 1
> #    else /* not Solaris */
> #     ifdef TheSCOThingWeNeed
> #      include "timepps-SCO.h"
> #      define HAVE_PPSAPI 1
> #     endif /* SCO */
> #    endif /* not Solaris */
> #   endif /* not Sunos */
> #  endif /* not HAVE_SYS_TIMEPPS_H */
> # endif /* HAVE_TIMEPPS_H */
> #endif /* HAVE_PPSAPI */
>and this started to appear in a number of driver files.
>I decided that I would *much* rather see:
> #ifdef HAVE_PPSAPI
> # include "ppsapi-timepps.h"
> #endif
>in the 5 (or so) source files, and only put the #ifdef "nest" (either the
>old one or the new one) in one place, namely ppsapi-timepps.h .
>That's what I did, and the result seems to be much cleaner.
>>From what I can see, the only potential problem with this is the case
>where the different timepps-OS.h files are not really usable as-is, and
>must be tweaked somehow.
>Am I missing something?

More information about the hackers mailing list