[LinuxPPS] PPS/ntpd fails on fresh startup
Cirilo Bernardo
cirilo.bernardo at gmail.com
Wed Oct 15 12:19:59 CEST 2008
On Wed, Oct 15, 2008 at 9:14 PM, Luca Bertagnolio <time at berta.com> wrote:
> On Wed, Oct 15, 2008 at 12:08 PM, Rodolfo Giometti
> <giometti at enneenne.com> wrote:
>> Luca, what exactly the refclock_open() does with such parameter? And
>> how it is defined inside the code?
>
> there you go:
>
[snip]
> fd = open(dev, omode, 0777);
> if (fd < 0) {
> msyslog(LOG_ERR, "refclock_open %s: %m", dev);
> return (0);
> }
> if (!refclock_setup(fd, speed, lflags)) {
> close(fd);
> return (0);
> }
> if (!refclock_ioctl(fd, lflags)) {
> close(fd);
> return (0);
> }
[snip]
>
> refclock_ioctl is defined as such:
>
[snip]
> #if !defined SYS_VXWORKS && !defined SYS_WINNT
> #if defined(HAVE_TERMIOS) || defined(HAVE_SYSV_TTYS) || defined(HAVE_BSD_TTYS)
>
> #ifdef DEBUG
> if (debug)
> printf("refclock_ioctl: fd %d flags 0x%x\n", fd,
> lflags);
> #endif
> #ifdef TTYCLK
>
> /*
> * The TTYCLK option provides timestamping at the driver level.
> * It requires the tty_clk streams module and System V STREAMS
> * support. If not available, don't complain.
> */
> if (lflags & (LDISC_CLK | LDISC_CLKPPS | LDISC_ACTS)) {
> int rval = 0;
>
> if (ioctl(fd, I_PUSH, "clk") < 0) {
> msyslog(LOG_NOTICE,
> "refclock_ioctl fd %d I_PUSH: %m", fd);
> return (0);
> #ifdef CLK_SETSTR
> } else {
> char *str;
>
> if (lflags & LDISC_CLKPPS)
> str = "\377";
> else if (lflags & LDISC_ACTS)
> str = "*";
> else
> str = "\n";
> if (ioctl(fd, CLK_SETSTR, str) < 0) {
> msyslog(LOG_ERR,
> "refclock_ioctl fd %d CLK_SETSTR: %m", fd);
> return (0);
> }
> #endif /*CLK_SETSTR */
> }
> }
> #endif /* TTYCLK */
> #endif /* HAVE_TERMIOS || HAVE_SYSV_TTYS || HAVE_BSD_TTYS */
> #endif /* SYS_VXWORKS SYS_WINNT */
> return (1);
> }
>
> and this is there is some reference to LDISC flags and their use in
> the true ioctl.
>
> HTH --L
>
Well, you can see that if debugging is enabled, you should be able to
see in the ntpd log if the ldisc is changed.
- Cirilo
More information about the LinuxPPS
mailing list