[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] [PATCH] Time Service HOWTO: Clarify state of RFC2783 on N

From: Hal Murray
Subject: Re: [gpsd-dev] [PATCH] Time Service HOWTO: Clarify state of RFC2783 on NetBSD.
Date: Tue, 26 Aug 2014 19:21:22 -0700

> But we'll add whatever you want to try for NetBSD.  If ntpd does it, where
> should I look for that code? 

The ntpd PPS code is in ntpd/ntp_refclock.c

I don't think ntpd does anything special in this area for NetBSD.

ntpd uses the RFC2783 interface.  There is no reference to TIOCMIWAIT in the 
ntpd code.

The main drivers that use PPS are ATOM and NMEA.  (My view of "main" may be 
biased those are the ones I'm familiar with.)

The ATOM driver opens /dev/pps<n>.  If that's not the right device you are 
expected to setup a link.  The NMEA driver tries /dev/gps<n>.  Again, that's 
probably a link.  If that doesn't work for the PPS stuff, it tries 

With RFC2783, the kernel grabs the timestamp at interrupt time.  Userland can 
ask for the latest one any time.  There is a sequence number to detect 
duplicates.  ntpd polls every second.

There is another part of RFC2783.  It moves the whole PPL into the kernel.  
I've never understood why that is needed.

RFC2783 has worked on NetBSD and FreeBSD for a long long time.  (The RFC is 
from 2000.)

It used to work on Linux.  I think it took a patch.  I forget.  Then somebody 
cleaned things up and the patch broke or that stuff fell through the cracks 
or something.  The timestamping part is now supported again.  It uses/needs 
ldattach, and you have to set it up before starting ntpd with something like:
  ldattach 18 /dev/ttyS0 &
which makes /dev/pps<n>

That stuff all gets tangled up with the new systemd stuff.  I haven't seen a 
good description of how to cleanly start ntpd that uses PPS using systemd.  I 
start it from rc.local.  (I haven't looked very hard.)


If I understand things correctly, gpsd uses TIOCMIWAIT and grabs the time 
from userland as soon as it can.  Thus it depends on kernel support for 
TIOCMIWAIT rather than RFC2783.  That may have changed in the last year or 

I have a note saying that TIOCMIWAIT doesn't work on NetBSD or FreeBSD.  I 
can't find it in /usr/include on systems running the latest release.  I'll be 
happy to help test the new code.

These are my opinions.  I hate spam.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]