[comp.protocols.time.ntp] ntpdate fails except from the command line of cshell

A.Raman@massey.ac.nz (A.V.Raman) (11/15/90)

When I run ntpdate from the csh command line like so
csh>ntpdate ntphost
ntpdate: adjust timeserver 130.123.1.7 offset 0.0071640

it works fine.  But that's all.  None of the following works.

$ ntpdate ntphost
ntpdate: no server suitable for synchronization found
$ sh -c "ntpdate ntphost"
ntpdate: no server suitable for synchronization found
$ csh -c "ntpdate ntphost"
ntpdate: no server suitable for synchronization found
$ ^D
csh> csh -c "ntpdate ntphost"
ntpdate: no server suitable for synchronization found
csh> sh -c "ntpdate ntphost"
ntpdate: no server suitable for synchronization found
csh> csh <<end
ntpdate ntphost
end
ntpdate: no server suitable for synchronization found
csh> cat ntptest
ntpdate ntphost
csh> ntptest
ntpdate: no server suitable for synchronization found
csh> sh <ntptest
ntpdate: no server suitable for synchronization found

What is it with the -c command switch that disables ntpdate on the Pyramid
from receiving udp packets from ntphost?

The Pyramid runs OSx 5.0 and supports two universes - att and ucb.

sh -c ntpdate and csh -c ntpdate work fine on other machines (DEC stations
and Suns)

Any pointers?

Thanks very much.

-& (Anand)

rees@pisa.ifs.umich.edu (Jim Rees) (11/16/90)

In article <1990Nov14.203218.18459@massey.ac.nz>, A.Raman@massey.ac.nz (A.V.Raman) writes:
  When I run ntpdate from the csh command line like so
  csh>ntpdate ntphost
  ntpdate: adjust timeserver 130.123.1.7 offset 0.0071640
  
  it works fine.  But that's all.  None of the following works.

I'm not sure this is your problem, but on my Apollo I had to make the
following fix:

*** ntpdate.c_o	Wed Apr 11 12:32:17 1990
--- ntpdate.c	Wed Apr 11 12:31:31 1990
***************
*** 1158,1163 ****
--- 1158,1165 ----
  	full_recvbufs = 0;
  	free_recvbufs = sys_numservers + 2;
  
+ 	setpgrp(0, getpid());
+ 
  	/*
  	 * Point SIGIO at service routine
  	 */

It seems the SIGIO gets lost, because the pid of the process that opened
the socket (or set the SIGIO?) isn't the same as the process group that
wants to get the SIGIO.

  The Pyramid runs OSx 5.0 and supports two universes - att and ucb.

That's nothing.  My Apollo has at least three or four universes (bsd4.1,
bsd4.2, bsd4.3, sys5.2, sys5.3, ad nauseum).  I run ntpdate in the bsd4.3
universe.  Maybe this is a universal problem?

  sh -c ntpdate and csh -c ntpdate work fine on other machines (DEC stations
  and Suns)

This could be construed as a bug on those machines, since the SIGIO should
only go the pgroup of the process that owns the socket.  But since the
difference between a bug and a feature is often simply which is more
popular, maybe it really is a feature.

By the way, ntpd has the same problem.  Here's the fix.

*** xntpd/ntpd.c/1	Sat Sep 23 17:22:45 1989
--- xntpd/ntpd.c	Fri Mar 23 00:38:51 1990
***************
*** 119,124 ****
--- 119,125 ----
  				(void) ioctl(s, (u_long) TIOCNOTTY, (char *) 0);
  				(void) close(s);
  			}
+ 			(void) setpgrp(0, getpid());
  		}
  #ifdef	DEBUG
  	}

Thanks to Bill Sommerfeld of Apollo for finding/fixing this.