clk_varitext.c \
data_mbg.c \
info_trimble.c \
- trim_info.c
+ trim_info.c \
+ binio.c \
+ ieee754io.c \
+ mfp_mul.c \
+ gpstolfp.c
libparse_kernel_a_SOURCES =
libparse_kernel_a_LIBADD = kparse$U.o \
kclk_trimtaip$U.o \
kclk_trimtsip$U.o \
kclk_varitext$U.o \
- kclk_wharton$U.o
+ kclk_wharton$U.o \
+ kbinio$U.o \
+ kieee754io$U.o \
+ kmfp_mul$U.o \
+ kgpstolfp$U.o
+
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/kernel
ETAGS_ARGS = Makefile.am
sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.c || rm -f info_trimble.c
sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.c || rm -f info_trimble.c
+kieee754io.o: ieee754io.c
+ $(COMPILE) $(K_CFLAGS) -c $(srcdir)/ieee754io.c -o $@
+
+kmfp_mul.o: mfp_mul.c
+ $(COMPILE) $(K_CFLAGS) -c $(srcdir)/mfp_mul.c -o $@
+
+kgpstolfp.o: gpstolfp.c
+ $(COMPILE) $(K_CFLAGS) -c $(srcdir)/gpstolfp.c -o $@
+
+kbinio.o: binio.c
+ $(COMPILE) $(K_CFLAGS) -c $(srcdir)/binio.c -o $@
+
kclk_computime.o: clk_computime.c
$(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_computime.c -o $@
/*
- * /src/NTP/ntp4-dev/libntp/mfp_mul.c,v 4.7 2005/04/16 17:32:10 kardel RELEASE_20050508_A
+ * /src/NTP/ntp4-dev/libparse/mfp_mul.c,v 4.9 2005/07/17 20:34:40 kardel RELEASE_20050717_A
*
- * mfp_mul.c,v 4.7 2005/04/16 17:32:10 kardel RELEASE_20050508_A
+ * mfp_mul.c,v 4.9 2005/07/17 20:34:40 kardel RELEASE_20050717_A
*
* $Created: Sat Aug 16 20:35:08 1997 $
*
#define LOW_MASK (u_int32)((1<<(FRACTION_PREC/2))-1)
#define HIGH_MASK (u_int32)(LOW_MASK << (FRACTION_PREC/2))
+/*
+ * for those who worry about overflows (possibly triggered by static analysis tools):
+ *
+ * Largest value of a 2^n bit number is 2^n-1.
+ * Thus the result is: (2^n-1)*(2^n-1) = 2^2n - 2^n - 2^n + 1 < 2^2n
+ * Here overflow can not happen for 2 reasons:
+ * 1) the code actually multiplies the absolute values of two signed
+ * 64bit quantities.thus effectively multiplying 2 63bit quantities.
+ * 2) Carry propagation is from low to high, building principle is
+ * addition, so no storage for the 2^2n term from above is needed.
+ */
+
void
mfp_mul(
int32 *o_i,
u_int32 f;
u_long a[4]; /* operand a */
u_long b[4]; /* operand b */
- u_long c[4]; /* result c */
+ u_long c[5]; /* result c - 5 items for performance - see below */
+ u_long carry;
int neg = 0;
b[2] = b_i & LOW_MASK;
b[3] = (b_i & HIGH_MASK) >> (FRACTION_PREC/2);
- c[0] = c[1] = c[2] = c[3] = 0;
+ c[0] = c[1] = c[2] = c[3] = c[4] = 0;
for (i = 0; i < 4; i++) /* we do assume 32 * 32 = 64 bit multiplication */
for (j = 0; j < 4; j++)
{
u_long result_low, result_high;
-
+ int low_index = (i+j)/2; /* formal [0..3] - index for low long word */
+ int mid_index = 1+low_index; /* formal [1..4]! - index for high long word
+ will generate unecessary add of 0 to c[4]
+ but save 15 'if (result_high) expressions' */
+ int high_index = 1+mid_index; /* formal [2..5]! - index for high word overflow
+ - only assigned on overflow (limits range to 2..3) */
+
result_low = (u_long)a[i] * (u_long)b[j]; /* partial product */
if ((i+j) & 1) /* splits across two result registers */
{
result_high = result_low >> (FRACTION_PREC/2);
result_low <<= FRACTION_PREC/2;
+ carry = (unsigned)1<<(FRACTION_PREC/2);
}
else
{ /* stays in a result register - except for overflows */
result_high = 0;
+ carry = 1;
}
-
- if (((c[(i+j)/2] >> 1) + (result_low >> 1)) & (u_int32)((unsigned)1<<(FRACTION_PREC - 1)))
+
+ if (((c[low_index] >> 1) + (result_low >> 1) + ((c[low_index] & result_low & carry) != 0)) &
+ (u_int32)((unsigned)1<<(FRACTION_PREC - 1))) {
result_high++; /* propagate overflows */
+ }
- c[(i+j)/2] += result_low; /* add up partial products */
+ c[low_index] += result_low; /* add up partial products */
- if (((c[(i+j+1)/2] >> 1) + (result_high >> 1)) & (u_int32)((unsigned)1<<(FRACTION_PREC - 1)))
- c[1+(i+j)/2]++; /* propagate overflows */
+ if (((c[mid_index] >> 1) + (result_high >> 1) + ((c[mid_index] & result_high & 1) != 0)) &
+ (u_int32)((unsigned)1<<(FRACTION_PREC - 1))) {
+ c[high_index]++; /* propagate overflows of high word sum */
+ }
- c[(i+j+1)/2] += result_high;
+ c[mid_index] += result_high; /* will add a 0 to c[4] once but saves 15 if conditions */
}
#ifdef DEBUG
* History:
*
* mfp_mul.c,v
+ * Revision 4.9 2005/07/17 20:34:40 kardel
+ * correct carry propagation implementation
+ *
+ * Revision 4.8 2005/07/12 16:17:26 kardel
+ * add explanation why we do not write into c[4]
+ *
* Revision 4.7 2005/04/16 17:32:10 kardel
* update copyright
*
/*
- * /src/NTP/ntp4-dev/ntpd/refclock_parse.c,v 4.57 2005/06/25 09:25:19 kardel RELEASE_20050625_A
+ * /src/NTP/ntp4-dev/ntpd/refclock_parse.c,v 4.60 2005/07/17 21:14:44 kardel RELEASE_20050717_A
*
- * refclock_parse.c,v 4.57 2005/06/25 09:25:19 kardel RELEASE_20050625_A
+ * refclock_parse.c,v 4.60 2005/07/17 21:14:44 kardel RELEASE_20050717_A
*
* generic reference clock driver for several DCF/GPS/MSF/... receivers
*
#include "ascii.h"
#include "ieee754io.h"
-static char rcsid[]="4.57";
+static char rcsid[] = "refclock_parse.c,v 4.60 2005/07/17 21:14:44 kardel RELEASE_20050717_A";
/**===========================================================================
** external interface to ntp mechanism
**/
-static void parse_init P((void));
static int parse_start P((int, struct peer *));
static void parse_shutdown P((int, struct peer *));
static void parse_poll P((int, struct peer *));
static void parse_control P((int, struct refclockstat *, struct refclockstat *, struct peer *));
-#define parse_buginfo noentry
-
struct refclock refclock_parse = {
parse_start,
parse_shutdown,
parse_poll,
parse_control,
- parse_init,
- parse_buginfo,
+ noentry,
+ noentry,
NOFLAGS
};
#define PARSESTATISTICS (60*60) /* output state statistics every hour */
-static struct parseunit *parseunits[MAXUNITS];
-
static int notice = 0;
#define PARSE_STATETIME(parse, i) ((parse->generic->currentstatus == i) ? parse->statetime[i] + current_time - parse->lastchange : parse->statetime[i])
printf(
"parse: local_receive: fd %d PPSAPI seq %ld - PPS %s\n",
rbufp->fd,
- pps_info.assert_sequence + pps_info.clear_sequence ,
+ (long)pps_info.assert_sequence + (long)pps_info.clear_sequence,
lfptoa(&parse->parseio.parse_dtime.parse_ptime.fp, 6));
}
#endif
printf(
"parse: local_receive: fd %d PPSAPI seq assert %ld, seq clear %ld - NO PPS event\n",
rbufp->fd,
- pps_info.assert_sequence, pps_info.clear_sequence);
+ (long)pps_info.assert_sequence, (long)pps_info.clear_sequence);
}
}
#endif
** ntp interface routines
**/
-/*--------------------------------------------------
- * parse_init - initialize internal parse driver data
- */
-static void
-parse_init(void)
-{
- memset((caddr_t)parseunits, 0, sizeof parseunits);
-}
-
-
/*--------------------------------------------------
* parse_shutdown - shut down a PARSE clock
*/
struct peer *peer
)
{
- struct parseunit *parse = (struct parseunit *)peer->procptr->unitptr;
+ struct parseunit *parse = (struct parseunit *)0;
+
+ if (peer && peer->procptr)
+ parse = (struct parseunit *)peer->procptr->unitptr;
- if (parse && !parse->peer)
+ if (!parse)
{
- msyslog(LOG_ERR,
- "PARSE receiver #%d: parse_shutdown: INTERNAL ERROR, unit not in use", unit);
+ /* nothing to clean up */
+ return;
+ }
+
+ if (!parse->peer)
+ {
+ msyslog(LOG_INFO, "PARSE receiver #%d: INTERNAL ERROR - unit already inactive - shutdown ignored", unit);
return;
}
CLK_UNIT(parse->peer), parse->parse_type->cl_description);
parse->peer = (struct peer *)0; /* unused now */
+ peer->procptr->unitptr = (caddr_t)0;
free(parse);
}
}
parse->binding = init_iobinding(parse);
- parse->generic->io.clock_recv = parse->binding->bd_receive; /* pick correct receive routine */
- parse->generic->io.io_input = parse->binding->bd_io_input; /* pick correct input routine */
if (parse->binding == (bind_t *)0)
{
return 0; /* well, ok - special initialisation broke */
}
+ parse->generic->io.clock_recv = parse->binding->bd_receive; /* pick correct receive routine */
+ parse->generic->io.io_input = parse->binding->bd_io_input; /* pick correct input routine */
+
/*
* as we always(?) get 8 bit chars we want to be
* sure, that the upper bits are zero for less
#endif
}
- /*
- * keep fudgetime2 in sync with TRUSTTIME/MAXUNSYNC flag1
- */
- parse->generic->fudgetime2 = (parse->flags & PARSE_TRUSTTIME) ? (double)parse->maxunsync : parse->ppsphaseadjust;
-
if (in->haveflags & CLK_HAVETIME1)
{
parse->generic->fudgetime1 = in->fudgetime1;
out->type = REFCLK_PARSE;
+ /*
+ * keep fudgetime2 in sync with TRUSTTIME/MAXUNSYNC flag1
+ */
+ parse->generic->fudgetime2 = (parse->flags & PARSE_TRUSTTIME) ? (double)parse->maxunsync : parse->ppsphaseadjust;
+
/*
* figure out skew between PPS and RS232 - just for informational
* purposes
* History:
*
* refclock_parse.c,v
+ * Revision 4.60 2005/07/17 21:14:44 kardel
+ * change contents of version string to include the RCS/CVS Id
+ *
+ * Revision 4.59 2005/07/06 06:56:38 kardel
+ * syntax error
+ *
+ * Revision 4.58 2005/07/04 13:10:40 kardel
+ * fix bug 455: tripping over NULL pointer on cleanup
+ * fix shadow storage logic for ppsphaseadjust and trustime wrt/ time2
+ * fix compiler warnings for some platforms wrt/ printf formatstrings and
+ * varying structure element sizes
+ * reorder assignment in binding to avoid tripping over NULL pointers
+ *
* Revision 4.57 2005/06/25 09:25:19 kardel
* sort out log output sequence
*
bin_SCRIPTS= ntp-wait ntptrace
noinst_SCRIPTS= calc_tickadj checktime freq_adj html2man mkver ntpsweep ntpver plot_summary summary
EXTRA_DIST = fixautomakedepsmagic hpadjtime.sh monitoring ntp-close \
- ntp-groper ntp-restart ntp-status rc1 rc2 stats support
+ ntp-groper ntp-restart ntp-status rc1 rc2 stats
+++ /dev/null
-The bin and etc directories contain several scripts (sh and perl) that
-should ease startup and configuration of NTP sites.
-
- bin/monl is a monitoring script that prints out new, current and
- old customers of an NTP timeserver when monitoring is
- in effect.
- monl has following options:
- -i <regexp> (regular expression matchin IP addres to be ignored
- -d <directory> where the current state is kept (default /tmp)
- -v debug output
- -n do not translate IP addresses into hostnames
- <host> host to be analyzed
-
- monl uses xntpdc for information gathering and is thus
- limited to the NTP version xntpdc is compiled for.
-
- bin/mvstats moves compresses and removes statistics files (useful mainly
- for reference servers
-
- etc/install creates the locally needed directories for NTP (if not residung in /etc)
-
- etc/rc starts up daemon with configuration file and key file
- etc/cron cron called monitor statistic (uses bin/monl)
- etc/crontab crontab prototype for reference time servers
- etc/setup sh script sourced by the other scripts for variable setup
-
-YOU MUST EDIT THESE FILES TO REFLECT YOUR LOCAL SETUP !
-
-READ THIS BEFORE USING THE STARTUP SCRIPTS
-
-The startupscript etc/rc has been written for Suns and HPs. They are not
-guaranteed to work elsewhere. Following assumptions have been made:
-
- All NTP related files reside in ONE directory having following structure:
-
- bin/* - all executables (daemon, control, date, scripts)
- etc/* - startup scripts and cron scripts
- conf/* - NTP configuration files
-
-The variable NTPROOT (etc/rc, etc/install) must be edited to reflect
-the NTP directory (e.g. /usr/local/NTP)
-
-NTP config files are located via Suns arch command and have the name
-conf/`arch`.`arch -k`.
-These are the default configurations (usually clients). If a file with the name
-conf/`arch`.`arch -k`.`hostname` is present this file will be preferred (Reference host,
-gateway). If the arch command is not available no-arch is used. The arch command
-is usually a shell script which echoes a string unique the the current machine
-architecture.
-
-The tickadj command has its own conf/tickconf file which is used to set host
-specific tickadj values. The line with DEFAULT specifies the default tickadj
-parameters, all other lines consists of <hostname> <hostid>
-<tickadj parameters>. These lines need only be entered if the specified host
-needs parameters different from the default parameters.
-
-Reference clock support is provided for DCF77. If you need to initialize
-certain things for reference clock support (e.g. loading STREAMS modules),
-you need to edit etc/rc.
-
-The current config files of Erlangen are included in the conf directory.
-They are just for reference, but might help you a bit in setting up a
-synchronisation network.
-
-The advantage of keeping all config files centralized is the easier
-administration.
-
-We replicate the NTP directory via NFS and rdist.
-
-When you have set up the local config files (YOUR OWN!) you can call
-<NTPROOT>/etc/rc for daemon startup.
-
-For more information: time@informatik.uni-erlangen.de
+++ /dev/null
-#!/local/bin/perl
-
-%service = ( 0, "unspec",
- 1, "Active",
- 2, "Passive",
- 3, "Client",
- 4, "Server",
- 5, "Broadcast",
- 6, "Control",
- 7, "Private" );
-%nc = ();
-@ignpat = ();
-$noname = 0;
-$verbose = 0;
-$retries = 5;
-$lastkey = 0;
-
-sub timedelta {
- local($tm, $days, $h, $m, $s);
-
- $tm = @_[$[];
- $days = 0;
- $days = sprintf("%dd+", $days) if $days = int($tm / (60*60*24));
- $days = "" unless $days;
- $tm = $tm % (60*60*24);
- $h = int($tm / (60*60));
- $tm = $tm % (60*60);
- $m = int($tm / 60);
- $s = $tm % 60;
-
- return sprintf("%s%02d:%02d:%02d", $days, $h, $m, $s);
-}
-
-sub listentry {
- local($host, $mode) = split("$;" , @_[$[]);
- local($count, $version, $firsttime) = split("$;" , $_[$[+1]);
- local($name);
-
- if (grep($host =~ m/$_/, @ignpat))
- {
- print "ignored $host ...\n" if $verbose;
- return;
- }
-
- return if ! $count;
-
- if (defined($nc{$host}))
- {
- $name = $nc{$host};
- }
- else
- {
- if ($noname)
- {
- $nc{$host} = $name = $host;
- }
- else
- {
- $name = (gethostbyaddr(pack("C4", split(/\./, $host)), 2))[$[];
- $nc{$host} = $name = $host if ! defined($name);
- }
- }
-
- printf ($fmt, ($lastkey eq $host) ? "" : $name, $service{$mode}, $count, $version, &timedelta($firsttime), $firsttime / $count);
-
- if (@_[$[+2])
- {
- $hostcnt++ if $lastkey ne $host;
- $packcnt += $count;
- $maxtime = $firsttime if $firsttime > $maxtime;
- }
-
- $lastkey = $host;
-}
-
-while ($ARGV[$[] =~ /^-[nvid]$/)
- {
- if ($ARGV[$[] eq "-i")
- {
- shift;
- push(@ignpat, shift) unless ! defined($ARGV[$[]);
- }
- elsif ($ARGV[$[] eq "-d")
- {
- shift;
- $dir = shift unless ! defined($ARGV[$[]);
- }
- elsif ($ARGV[$[] eq "-n")
- {
- shift;
- $noname = 1;
- }
- elsif ($ARGV[$[] eq "-v")
- {
- shift;
- $verbose = 1;
- }
- }
-
-$dir = "/tmp" unless defined($dir);
-$gone = 60*60*48;
-$fmt = "%48s %10s %7d %7d %13s %14.3f\n";
-$sfmt = "%48s %10s %7s %7s %13s %14s\n";
-@lbl = ("Host", "Mode", "Count", "Version", "Time active", "Packetinterval");
-
-if (!defined($ARGV[$[]))
- {
- $hostname = `hostname`;
- chop($hostname);
- unshift(@ARGV, $hostname);
- }
-
-foreach $hostname (@ARGV)
- {
- $dbmfile = $dir . "/monlstats-" . $hostname;
- $monl = "xntpdc -c 'hostnames no' -c monl $hostname | tail +3 |";
- $hostcnt = 0;
- $packcnt = 0;
- $maxtime = 0;
- %Seen = ();
- %New = ();
- %Old = ();
-
- print "Monitor Status of $hostname\n\n";
-
- $cnt = $retries;
- do
- {
- open(MONL, $monl) || die("$monl failed $!");
- @monlout = <MONL>;
- close(MONL);
- } while (! @monlout && $cnt--);
-
- if (! @monlout)
- {
- print "not available.\n";
- next;
- }
-
- dbmopen(Clients, $dbmfile, 0644) || die("dbmopen(.., $dbmfile, ...): $!");
-
- foreach (@monlout)
- {
- chop;
- split;
- ($host, $count, $mode, $version, $lasttime, $firsttime) =
- (@_[$[, $[+2 .. $[+4, $#_-1,$#_]);
-
- $Seen{$host, $mode} = 1;
-
- if (!defined($Clients{$host, $mode}))
- {
- if ($lasttime <= $gone)
- {
- ## got a new one
- $Clients{$host, $mode} = $New{$host, $mode} = join("$;", $count, $version, $firsttime, $lasttime);
- }
- }
- else
- {
- ## throw out the old ones
- if ($lasttime > $gone)
- {
- $Old{$host, $mode} = $Clients{$host, $mode};
- delete $Clients{$host, $mode};
- }
- else
- {
- $Clients{$host, $mode} = join("$;", $count, $version, $firsttime, $lasttime);
- }
- }
- }
-
- grep(($Seen{$_} || ($Old{$_} = delete $Clients{$_})), keys(%Clients));
-
- if (grep(($tmp = $_ , !grep($tmp =~ m/$_/, @ignpat)), keys(%New)))
- {
- print "New customers\n";
- print "-------------\n";
- printf $sfmt, @lbl;
- grep( &listentry($_, $New{$_}, 1), sort(keys(%New)) );
- print "\n";
- }
-
-
- if (grep((!defined($New{$_}) && ($tmp = $_, !grep($tmp =~ m/$_/, @ignpat))), keys(%Clients)))
- {
- print "Current customers\n";
- print "-----------------\n";
- printf $sfmt, @lbl;
- grep( defined($New{$_}) || &listentry($_, $Clients{$_}, 1) , sort(keys(%Clients)) );
- print "\n";
- }
-
- if (grep(($tmp = $_, !grep($tmp =~ m/$_/, @ignpat)), keys(%Old)))
- {
- print "Discarded customers\n";
- print "-------------------\n";
- printf $sfmt, @lbl;
- grep( &listentry($_, $Old{$_}, 0) , sort(keys(%Old)) );
- print "\n";
- }
-
- dbmclose(Clients);
-
- print "\nSummary:\n";
- print "--------\n";
- printf("Elapsed time: %13s\n", &timedelta($maxtime));
- printf(" Hosts: %13d\n", $hostcnt);
- printf(" Packets: %13d\n", $packcnt);
- printf(" Rate: %13.2f\n", $packcnt / $maxtime) if $maxtime;
- print "\n";
- }
+++ /dev/null
-#!/bin/sh
-#
-# mvstats,v 3.1 1993/07/06 01:10:24 jbj Exp
-#
-# mvstats is called by cron for keeping the log files together
-# usually only used on reference hosts
-#
-# Files reside in /var/NTP
-# Files older than 2 days will be compressed,
-# Files older than 64 days will be removed.
-#
-# mvstats,v
-# Revision 3.1 1993/07/06 01:10:24 jbj
-# XNTP release 3.1
-#
-#
-# Revision 1.1 1992/12/10 12:58:24 kardel
-# Prerelease NTP V3 / DCF
-#
-#
-cd /var/NTP
-find . ! -name '*.Z' -mtime +2 -exec compress -f {} \;
-find . -mtime +64 -exec rm -f {} \;
+++ /dev/null
-#
-# put your default configuration (e.g. broadcastclient) in here
-#
+++ /dev/null
-DEFAULT -A -p -s -q
-Lucifer 55406cfa -a 1 -p -s -q -t 10001
-faui45 24000f9b -a 1 -p -s -q
-faui10 2440213c -a 1 -p -s -q
-faui1b 54001418 -A -p -s -q -t 10001
-faui4p 5100344d -A -p -s -q -t 9999
-faui02g 1200be20 -A -p -s -q -t 9999
-faui02e 1200bbab -A -p -s -q -t 9999
-faui02f 1200bedb -A -p -s -q -t 9999
-faui03b 1200b92b -A -p -s -q -t 9999
-faui45m 726001ac -A -p -s -q -t 10001
-faui45o 72600272 -A -p -s -q -t 10001
-faui45p 7260028f -A -p -s -q -t 10001
-faui45r 72400cc7 -A -p -s -q -t 10001
-faui45s 726045be -A -p -s -q -t 10001
-faui45v 72604487 -A -p -s -q -t 10001
-faui45x 726044eb -A -p -s -q -t 10001
-faui45y 7260476d -A -p -s -q -t 10001
-faui45z 726045a1 -A -p -s -q -t 10001
+++ /dev/null
-#!/bin/sh
-#
-# cron,v 3.1 1993/07/06 01:10:50 jbj Exp
-#
-# called by cron for statistics gathering
-#
-# cron,v
-# Revision 3.1 1993/07/06 01:10:50 jbj
-# XNTP release 3.1
-#
-#
-# Revision 1.1 1992/12/10 12:59:18 kardel
-# Prerelease NTP V3 / DCF
-#
-#
-PATH="${PATH}:/local/NTP/bin"
-export PATH
-monl -d /local/NTP/monitor -i '127\.0\.0\.1' faui10 faui45 lucifer rackety.udel.edu
+++ /dev/null
-#
-# NTP statistics periodic cleanup - REFERENCE SERVER ONLY
-#
-#55 23 * * * sh /local/NTP/etc/mvstats
-#
-# gather NTP client statistics - REFERENCE SERVER ONLY
-#
-0 8,18 * * * /local/NTP/etc/cron 2>/dev/null | /usr/ucb/mail -s "NTP statistics" time@informatik.uni-erlangen.de
+++ /dev/null
-#!/bin/sh
-#
-# install,v 3.1 1993/07/06 01:10:53 jbj Exp
-#
-# install,v
-# Revision 3.1 1993/07/06 01:10:53 jbj
-# XNTP release 3.1
-#
-#
-# Revision 1.1 1992/12/10 12:59:21 kardel
-# Prerelease NTP V3 / DCF
-#
-# Revision 1.1 1992/06/18 14:50:08 kardel
-# Initial revision
-#
-#
-NTPROOT=/local/NTP # SITE SPECIFIC: where NTP resides
-#
-# where the local NTP state files reside (xntp.drift) ussualle /etc
-# this directory must not be shared as machine dependent data ist stored there
-#
-NTPDIR="/+private/local/NTP"
-#
-# get the initial setup
-#
-if [ ! -r $NTPROOT/etc/setup ]; then
- echo "ERROR: $NTPROOT/etc/setup missing - incorrect installation."
- exit 1
-else
- . $NTPROOT/etc/setup
-fi
-
-umask 022 # SITE SPECIFIC: local policy - watch out for NFS and "root" rights
-
-Mkdir() {
- p=""
- IFS="/"
- set -- $@
- IFS='
-'
- for pnc do
- if [ ! -d "$p/$pnc" ]; then
- ECHO -n "creating directory $p/$pnc"
- if mkdir "$p/$pnc"; then
- ECHO ""
- else
- ECHO " - FAILED"
- break;
- fi
- fi
- p="$p/$pnc"
- done
-}
-
-if [ ! -d "$NTPDIR" ]; then
- ECHO "installing NTP private data area ($NTPDIR)"
- if Mkdir "$NTPDIR"; then
- chmod 755 "$NTPDIR"
- ECHO "$NTPDIR created."
- fi
-else
- ECHO "NTP already installed."
- if [ -f "$NTPDIR/xntp.drift" ]; then
- ECHO "currently saved drift value:" `cat "$NTPDIR/xntp.drift"`
- fi
-fi
-
+++ /dev/null
-#!/bin/sh
-# NTP time synchronisation
-#
-# /src/NTP/REPOSITORY/v3/supportscripts/etc/rc,v 1.11 1993/07/09 13:17:00 kardel Exp
-#
-# rc,v
-# Revision 1.11 1993/07/09 13:17:00 kardel
-# local NTPROOT
-#
-# Revision 1.10 1993/07/09 11:37:29 kardel
-# Initial restructured version + GPS support
-#
-# Revision 1.9 1993/06/23 14:10:36 kardel
-# June 21st reconcilation
-#
-# Revision 1.7 1993/06/02 12:04:43 kardel
-# May 28th reconcilation & clenaup
-#
-#
-# non reference clock hosts will try to do an ntpdate on NTPSERVERS
-#
-NTPSERVERS="ntps1-0 ntps1-1 ntps2-0 ntps2-1"
-NTPROOT=/local/NTP
-
-#
-# get the initial setup
-#
-if [ ! -r $NTPROOT/etc/setup ]; then
- echo "ERROR: $NTPROOT/etc/setup missing - incorrect installation."
- exit 1
-else
- . $NTPROOT/etc/setup
-fi
-
-umask 022 # SITE SPECIFIC: local policy - watch out for NFS and "root" rights
-
-msg=""
-#
-# default configuration files are named $NTPROOT/conf/<ARCH>.<KARCH>
-#
-CF=$NTPROOT/conf/$ARCH.$KARCH # default configuration file
-#
-# Host specific config file (reference clocks) have the hostname tagged on
-#
-CFH="$CF"."$HOSTNAME" # specific configuration file
-#
-# where to find the tickadj command
-#
-KFIX=$NTPROOT/bin/tickadj # kernel variable fix
-#
-# where to find special tickadj parameters
-#
-TC=$NTPROOT/conf/tickconf # special tickadj parameters
-#
-# where to find the keys file (if not found $KEY.dumb will be used)
-#
-KEY=$NTPROOT/conf/ntp.keys # private key file
-#
-# the daemon
-#
-XD=$NTPROOT/bin/xntpd # NTP daemon
-#
-# HP adjtimed
-#
-ADJTIMED=$NTPROOT/bin/adjtimed # HP special (adjtime() emulation)
-#
-# ntpdate command
-#
-NTPDATE=$NTPROOT/bin/ntpdate
-
-#
-# secondary timed support
-# The word "TIMED" must be in the config file for timed to start
-# Note that this times is a special version which does not ever set or
-# adjust the time. Ask time@informatik.uni-erlangen.de for patches
-#
-TIMED=$NTPROOT/bin/timed # timed (Berkeley) secondary time service
- # here used in a *HARMLESS* version
- # to provide time to "inferior" systems
-#
-# ISREFHOST is a command that returns exit status 0 for a reference host
-# Site specific: sample for dcf77 is given
-#
-ISREFHOST="[ -f $NTPROOT/.karch.$KARCH/sys/OBJ/parsestreams.o -a -f /dev/refclock-0 ]"
-#
-# SETUP_REFCLOCK
-#
-# what to do in order to set up a local reference clock
-# usually this will load a STREAMS module or initialize other things
-# needed
-#
-SETUP_REFCLOCK() {
- if modstat | grep -s 'PARSE'; then
- ECHO "loadable PARSER STREAMS module already loaded."
- else
- ECHO "attempting to load PARSER STREAMS module..."
- MDLFILE="/tmp/mdl.$$"
- if modload $NTPROOT/.karch.$KARCH/sys/OBJ/parsestreams.o -o $MDLFILE 2>&1; then
- modstat
- else
- echo WARNING: load FAILED
- fi | LOG
- rm -f $MDLFILE
- unset MDLFILE
- fi
-}
-
-kargs() {
- MATCH=NO
- HOSTID="`(hostid) 2>/dev/null || echo 000000`"
- if [ -r "$TC" ]; then
- exec 0< "$TC"
- while [ "$MATCH" != "YES" ] && read HOST ID PARAM; do
- if [ "$HOST" = "DEFAULT" ]; then
- DEFAULT="$ID $PARAM"
- else
- if [ "$ID" = "$HOSTID" -o "$HOST" = "$HOSTNAME" ]; then
- echo "$PARAM"
- MATCH=YES
- fi
- fi
- done
- if [ "$MATCH" != "YES" ]; then
- if [ -z "$DEFAULT" ]; then
- echo "-A -p -s -q";
- else
- echo "$DEFAULT";
- fi
- fi
- else
- echo "-A -p -s -q";
- fi
-}
-
-if [ -x $XD ]; then
- if [ -x "$ADJTIMED" ]; then
- $ADJTIMED && ECHO "adjusttimesupport: adjtimed."
- fi
- #
- # WARNING: check ps command first, or you might kill things you don't want to
- #
- PID="`(ps -efa 2>/dev/null || ps auxww 2>/dev/null || echo "") | grep xntp | grep -v grep | awk '{ print $2 }'`"
-
- if [ ! -z "$PID" ]; then
- ECHO "killing old NTP daemon (PID=$PID)"
- #
- # enable this after checking for correctness
- # kill $PID
- ECHO "should do a kill $PID, if this is the right PID - check rc script"
- fi
- #
- # try an ntpdate when timeservers are configured
- #
- if [ ! -z "$NTPSERVERS" -a -x $NTPDATE ]; then
- ECHO "NTP initial time setting"
- $NTPDATE -v $NTPSERVERS | LOG
- fi
- #
- # look for reference clock equipment
- #
- if $ISREFHOST; then
- ECHO "REFERENCE CLOCK SUPPORT (initializing...)"
- SETUP_REFCLOCK
- fi
-
- if [ -r "$CFH" ]; then
- CF="$CFH"
- else
- if [ ! -r "$KEY" ]; then
- KEY="$KEY.dumb"
- fi
- fi
-
- ECHO "NTP configuration file: $CF"
- ECHO -n "time daemon startup:"
-
- if [ -r "$CF" ]; then
- if [ -x "$KFIX" ]; then
- KARGS="`kargs`"
- if [ ! -z "$KARGS" ]; then
- $KFIX $KARGS && ECHO -n "tickadj $KARGS"
- fi
- fi
- $XD -c "$CF" -k "$KEY" && ECHO -n ' xntpd'
- if [ -x "$TIMED" ] && grep -s TIMED "$CF"; then
- $TIMED -M -N && ECHO -n ' timed'
- fi
- else
- msg="configuration file ($CF) not present."
- fi
-else
- msg="daemon binary ($XD) not present."
-fi
-ECHO "."
-
-if [ "$msg" ]; then
- NLECHO "WARNING: NO NTP time sychronisation: $msg"
-fi
+++ /dev/null
-#
-# setup,v 3.1 1993/07/06 01:10:55 jbj Exp
-#
-# /bin/sh sourced file for environment setup
-# expects NTPROOT variable initialized
-#
-# if not set it will be initialized to /usr/local/NTP
-#
-# setup,v
-# Revision 3.1 1993/07/06 01:10:55 jbj
-# XNTP release 3.1
-#
-#
-# Revision 1.1 1992/12/10 12:59:25 kardel
-# Prerelease NTP V3 / DCF
-#
-# Revision 1.1 1992/12/10 10:14:46 kardel
-# Initial revision
-#
-#
-NTPROOT=${NTPROOT-/usr/local/NTP}
-
-#
-# we so use our own echos, as we somes want to substitute them with a
-# file logging version durin the /etc/rc.local phase
-#
-set `type ECHO`
-
-PATH="${PATH}:$NTPROOT/bin"
-export PATH
-
-if [ "$2" = "is" ]; then
- :
-else
- #
- # find out the way echos work (Rest of rc thinks BSD echo)
- #
- ECHOREP="`echo -n x`"
- if [ "$ECHOREP" = "-n x" ]; then
- ECHO () {
- if [ "$1" = "-n" ]; then
- shift
- echo "$@\c"
- else
- echo "$@"
- fi
- }
- #ECHO "System V style echo"
- else
- ECHO () {
- echo "$@"
- }
- #ECHO "BSD style echo"
- fi
-
- NLECHO () {
- echo "$@"
- }
-
- LOG () {
- while read _line; do
- ECHO "$_line"
- done
- }
- #
- # carefully find out some configuration Variables
- #
- ARCH="`(arch) 2>/dev/null || ((uname) > /dev/null && uname -a | awk '{ print $6; }') 2>/dev/null || echo 'no-arch'`"
- KARCH="`(arch -k) 2>/dev/null || ((uname) > /dev/null && uname -a | awk '{ print $5 }') || echo 'no-arch'`"
- HOSTNAME="`(hostname) 2>/dev/null || uname -n`"
-fi
-