Subject: Re: ntp port request
To: Tom I Helbekkmo <tih@Hamartun.Priv.NO>
From: Jan-Hinrich Fessel <oskar@zappa.unna.ping.de>
List: current-users
Date: 02/06/1996 22:33:22
In message <Pine.NEB.3.91.960206190943.16213A-100000@barsoom.Hamartun.Priv.NO>
you write:
> The bit of code that uses it is in xntpd/ntp_io.c, and this #define
> will cause it to set the serial port to be the controlling terminal
> before doing a fcntl(fd, F_SETOWN, pid) on it.

I have found this bit of code some time ago, but it wouldn't work for me:

        if (ioctl(rio->fd, TIOCSCTTY, 0) == -1) {
                syslog(LOG_ERR, "ioctl(TIOCSCTTY, 0) fails for clock I/O: %m");
                if (ioctl(rio->fd, TIOCSCTTY, 0) == -1) { 
                        syslog(LOG_ERR, "ioctl(TIOCSCTTY, 0) 2nd try fails for 
clock I/O: %m");
                        return 1; 
                }
        }

always yields:
Feb  5 21:43:10 zappa xntpd[1168]: ioctl(TIOCSCTTY, 0) fails for clock I/O: 
Operation not permitted
Feb  5 21:43:10 zappa xntpd[1168]: ioctl(TIOCSCTTY, 0) 2nd try fails for clock 
I/O: Operation not permitted

I even tried to use setsid(), to no avail, because it equally failes.

devices:
zappa# ls -l /dev/refclo*
crw-rw-rw-  2 uucp  wheel    8,   5 Oct  6 12:09 /dev/refclock-1
zappa# ls -l /dev/tty05
crw-rw-rw-  2 uucp  wheel    8,   5 Oct  6 12:09 /dev/tty05
zappa# dmesg |grep com
    oskar@zappa.unna.Ping.DE:/usr/src/sys/arch/i386/compile/ZAPPA
com1 at ast0 slave 0: ns16550a, working fifo
com2 at ast0 slave 1: ns8250 or ns16450, no fifo
com3 at ast0 slave 2: ns16550a, working fifo
com4 at ast0 slave 3: ns16550a, working fifo
com0 at isa0 port 0x3f8-0x3ff irq 4: ns8250 or ns16450, no fifo
com5 at isa0 port 0x2f8-0x2ff irq 3: ns8250 or ns16450, no fifo

Gruesse
       Oskar

 ==============================================================================
 					Tragbar ist, was nicht herunterfaellt.
						    oskar@zappa.unna.ping.de
 ==============================================================================