Subject: Re: kern/30815: ntpd refclockio broken wrt/ SIGIO
To: Christos Zoulas <>
From: Frank Kardel <Frank.Kardel@Acrys.COM>
List: netbsd-bugs
Date: 07/25/2005 22:34:41
Christos Zoulas wrote:

>On Jul 23,  1:30pm, ( wrote:
>-- Subject: kern/30815: ntpd refclockio broken wrt/ SIGIO
>| 	The recent relaxation to allow SIGIO on tty descriptors without
>| 	requiring TIOCSCTTY is incomplete. Current version 1.9 of
>| 	usr.sbin/ntp/include/config.h has USE_FSETOWNCTTY commented out.
>| 	So ntpd doesn't aquire a CTTY. Fact is that currently TTY input
>| 	does not cause a SIGIO to be delivered in this setup.
>| 	ntpd pretends to run because of network SIGIOs, but ntpd is
>|         unable to actually use a tty refclock as input on a TTY as
>| 	input is batched in intervals of network caused SIGIOs.
>| 	So, currently ntpd refclock support is broken.
>Does the code set FIOASYNC?
Yep. As you can see in the ktraces in 30815 the only difference id the 
The relevant section in libntp/iosignal.c is:

#       if defined(TIOCSCTTY) && defined(USE_FSETOWNCTTY)
                 * there are, however, always exceptions to the rules
                 * one is, that OSF accepts SETOWN on TTY fd's only, iff 
they ar
                 * CTTYs. SunOS and HPUX do not semm to have this 
                 * another question is: how can you do multiple SIGIO 
from sever
                 * ttys (as they all should be CTTYs), wondering...
                 * kd 95-07-16
                if (ioctl(rio->fd, TIOCSCTTY, 0) == -1)
                        msyslog(LOG_ERR, "ioctl(TIOCSCTTY, 0) fails for 
clock I/
O: %m");
                        return 1;
#       endif /* TIOCSCTTY && USE_FSETOWNCTTY */

                if (fcntl(rio->fd, F_SETOWN, getpid()) == -1)
                        msyslog(LOG_ERR, "fcntl(F_SETOWN) fails for 
clock I/O: %
                        return 1;

                if (fcntl(rio->fd, F_SETFL, FNDELAY|FASYNC) < 0)
                                "fcntl(FNDELAY|FASYNC) fails for clock 
I/O: %m")
                        return 1;
                return 0;

As you can see the CTTY is a long standing issue (see my comment from 
and I'd be all too happy if it improves on NetBSD.

I'll give 1.175 a shot - I just saw it coming in.