Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/timed Code cleanup; remove all `#ifdef sgi' from th...



details:   https://anonhg.NetBSD.org/src/rev/dbd664afd6a7
branches:  trunk
changeset: 514409:dbd664afd6a7
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Sun Sep 02 00:13:05 2001 +0000

description:
Code cleanup; remove all `#ifdef sgi' from the code... this clobbered the
code considerably and was mainly providing SGI specific logging facilities
and some hacks to improve the relyablility on SGI systems by increasing
priorities etc...

diffstat:

 usr.sbin/timed/timed/acksend.c      |    8 +-
 usr.sbin/timed/timed/byteorder.c    |    6 +-
 usr.sbin/timed/timed/candidate.c    |    6 +-
 usr.sbin/timed/timed/cksum.c        |    6 +-
 usr.sbin/timed/timed/correct.c      |  110 +------------------------------
 usr.sbin/timed/timed/globals.h      |   14 +---
 usr.sbin/timed/timed/master.c       |   86 +-----------------------
 usr.sbin/timed/timed/measure.c      |   15 +---
 usr.sbin/timed/timed/networkdelta.c |    8 +-
 usr.sbin/timed/timed/pathnames.h    |    7 +-
 usr.sbin/timed/timed/readmsg.c      |   12 +--
 usr.sbin/timed/timed/slave.c        |   40 +----------
 usr.sbin/timed/timed/timed.c        |  126 +-----------------------------------
 usr.sbin/timed/timedc/cmds.c        |   13 +---
 usr.sbin/timed/timedc/timedc.c      |    8 +-
 usr.sbin/timed/timedc/timedc.h      |    5 +-
 16 files changed, 32 insertions(+), 438 deletions(-)

diffs (truncated from 1022 to 300 lines):

diff -r 6e8fc13b70fc -r dbd664afd6a7 usr.sbin/timed/timed/acksend.c
--- a/usr.sbin/timed/timed/acksend.c    Sat Sep 01 23:54:57 2001 +0000
+++ b/usr.sbin/timed/timed/acksend.c    Sun Sep 02 00:13:05 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acksend.c,v 1.5 1997/10/17 14:19:09 lukem Exp $        */
+/*     $NetBSD: acksend.c,v 1.6 2001/09/02 00:13:05 reinoud Exp $      */
 
 /*-
  * Copyright (c) 1985, 1993 The Regents of the University of California.
@@ -38,14 +38,10 @@
 #if 0
 static char sccsid[] = "@(#)acksend.c  8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: acksend.c,v 1.5 1997/10/17 14:19:09 lukem Exp $");
+__RCSID("$NetBSD: acksend.c,v 1.6 2001/09/02 00:13:05 reinoud Exp $");
 #endif
 #endif /* not lint */
 
-#ifdef sgi
-#ident "$Revision: 1.5 $"
-#endif
-
 #include "globals.h"
 
 
diff -r 6e8fc13b70fc -r dbd664afd6a7 usr.sbin/timed/timed/byteorder.c
--- a/usr.sbin/timed/timed/byteorder.c  Sat Sep 01 23:54:57 2001 +0000
+++ b/usr.sbin/timed/timed/byteorder.c  Sun Sep 02 00:13:05 2001 +0000
@@ -36,14 +36,10 @@
 #if 0
 static char sccsid[] = "@(#)byteorder.c        8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: byteorder.c,v 1.5 1997/10/17 14:19:12 lukem Exp $");
+__RCSID("$NetBSD: byteorder.c,v 1.6 2001/09/02 00:13:05 reinoud Exp $");
 #endif
 #endif /* not lint */
 
-#ifdef sgi
-#ident "$Revision: 1.5 $"
-#endif
-
 #include "globals.h"
 
 /*
diff -r 6e8fc13b70fc -r dbd664afd6a7 usr.sbin/timed/timed/candidate.c
--- a/usr.sbin/timed/timed/candidate.c  Sat Sep 01 23:54:57 2001 +0000
+++ b/usr.sbin/timed/timed/candidate.c  Sun Sep 02 00:13:05 2001 +0000
@@ -36,14 +36,10 @@
 #if 0
 static char sccsid[] = "@(#)candidate.c        8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: candidate.c,v 1.6 1997/10/17 14:19:17 lukem Exp $");
+__RCSID("$NetBSD: candidate.c,v 1.7 2001/09/02 00:13:05 reinoud Exp $");
 #endif
 #endif /* not lint */
 
-#ifdef sgi
-#ident "$Revision: 1.6 $"
-#endif
-
 #include "globals.h"
 
 /*
diff -r 6e8fc13b70fc -r dbd664afd6a7 usr.sbin/timed/timed/cksum.c
--- a/usr.sbin/timed/timed/cksum.c      Sat Sep 01 23:54:57 2001 +0000
+++ b/usr.sbin/timed/timed/cksum.c      Sun Sep 02 00:13:05 2001 +0000
@@ -36,14 +36,10 @@
 #if 0
 static char sccsid[] = "@(#)cksum.c    5.2 (Berkeley) 5/11/93";
 #else
-__RCSID("$NetBSD: cksum.c,v 1.2 1997/10/17 14:19:20 lukem Exp $");
+__RCSID("$NetBSD: cksum.c,v 1.3 2001/09/02 00:13:06 reinoud Exp $");
 #endif
 #endif /* not lint */
 
-#ifdef sgi
-#ident "$Revision: 1.2 $"
-#endif
-
 #include <sys/types.h>
 #include "globals.h"
 
diff -r 6e8fc13b70fc -r dbd664afd6a7 usr.sbin/timed/timed/correct.c
--- a/usr.sbin/timed/timed/correct.c    Sat Sep 01 23:54:57 2001 +0000
+++ b/usr.sbin/timed/timed/correct.c    Sun Sep 02 00:13:05 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: correct.c,v 1.8 1997/10/17 14:19:23 lukem Exp $        */
+/*     $NetBSD: correct.c,v 1.9 2001/09/02 00:13:06 reinoud Exp $      */
 
 /*-
  * Copyright (c) 1985, 1993 The Regents of the University of California.
@@ -38,21 +38,14 @@
 #if 0
 static char sccsid[] = "@(#)correct.c  8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: correct.c,v 1.8 1997/10/17 14:19:23 lukem Exp $");
+__RCSID("$NetBSD: correct.c,v 1.9 2001/09/02 00:13:06 reinoud Exp $");
 #endif
 #endif /* not lint */
 
-#ifdef sgi
-#ident "$Revision: 1.8 $"
-#endif
-
 #include "globals.h"
 #include <math.h>
 #include <sys/types.h>
 #include <sys/times.h>
-#ifdef sgi
-#include <sys/syssgi.h>
-#endif /* sgi */
 
 static void adjclock(struct timeval*);
 
@@ -181,105 +174,6 @@
                if (settimeofday(&now, 0) < 0)
                        syslog(LOG_ERR, "settimeofday: %m");
        }
-
-#ifdef sgi
-       /* Accumulate the total change, and use it to adjust the basic
-        * clock rate.
-        */
-       if (++passes > 2) {
-#define F_USEC_PER_SEC (1000000*1.0)   /* reduce typos */
-#define F_NSEC_PER_SEC (F_USEC_PER_SEC*1000.0)
-
-               extern char *timetrim_fn;
-               extern char *timetrim_wpat;
-               extern long timetrim;
-               extern double tot_adj, hr_adj;  /* totals in nsec */
-               extern double tot_ticks, hr_ticks;
-
-               static double nag_tick;
-               double cur_ticks, hr_delta_ticks, tot_delta_ticks;
-               double tru_tot_adj, tru_hr_adj; /* nsecs of adjustment */
-               double tot_trim, hr_trim;   /* nsec/sec */
-               struct tms tm;
-               FILE *timetrim_st;
-
-               cur_ticks = times(&tm);
-               tot_adj += delta*1000.0;
-               hr_adj += delta*1000.0;
-
-               tot_delta_ticks = cur_ticks-tot_ticks;
-               if (tot_delta_ticks >= 16*SECDAY*CLK_TCK) {
-                       tot_adj -= rint(tot_adj/16);
-                       tot_ticks += rint(tot_delta_ticks/16);
-                       tot_delta_ticks = cur_ticks-tot_ticks;
-               }
-               hr_delta_ticks = cur_ticks-hr_ticks;
-
-               tru_hr_adj = hr_adj + timetrim*rint(hr_delta_ticks/CLK_TCK);
-               tru_tot_adj = (tot_adj
-                              + timetrim*rint(tot_delta_ticks/CLK_TCK));
-
-               if (hr_delta_ticks >= SECDAY*CLK_TCK
-                   || (tot_delta_ticks < 4*SECDAY*CLK_TCK
-                       && hr_delta_ticks >= SECHR*CLK_TCK)
-                   || (trace && hr_delta_ticks >= (SECHR/10)*CLK_TCK)) {
-
-                       tot_trim = rint(tru_tot_adj*CLK_TCK/tot_delta_ticks);
-                       hr_trim = rint(tru_hr_adj*CLK_TCK/hr_delta_ticks);
-
-                       if (trace
-                           || (abs(timetrim - hr_trim) > 100000.0
-                               && 0 == timetrim_fn
-                               && ((cur_ticks - nag_tick)
-                                   >= 24*SECDAY*CLK_TCK))) {
-                               nag_tick = cur_ticks;
-                               syslog(LOG_NOTICE,
-                  "%+.3f/%.2f or %+.3f/%.2f sec/hr; timetrim=%+.0f or %+.0f",
-                                      tru_tot_adj/F_NSEC_PER_SEC,
-                                      tot_delta_ticks/(SECHR*CLK_TCK*1.0),
-                                      tru_hr_adj/F_NSEC_PER_SEC,
-                                      hr_delta_ticks/(SECHR*CLK_TCK*1.0),
-                                      tot_trim,
-                                      hr_trim);
-                       }
-
-                       if (tot_trim < -MAX_TRIM || tot_trim > MAX_TRIM) {
-                               tot_ticks = hr_ticks;
-                               tot_adj = hr_adj;
-                       } else if (0 > syssgi(SGI_SETTIMETRIM,
-                                             (long)tot_trim)) {
-                               syslog(LOG_ERR, "SETTIMETRIM(%d): %m",
-                                      (long)tot_trim);
-                       } else {
-                               if (0 != timetrim_fn) {
-                                   timetrim_st = fopen(timetrim_fn, "w");
-                                   if (0 == timetrim_st) {
-                                       syslog(LOG_ERR, "fopen(%s): %m",
-                                              timetrim_fn);
-                                   } else {
-                                       if (0 > fprintf(timetrim_st,
-                                                       timetrim_wpat,
-                                                       (long)tot_trim,
-                                                       tru_tot_adj,
-                                                       tot_delta_ticks)) {
-                                               syslog(LOG_ERR,
-                                                      "fprintf(%s): %m",
-                                                      timetrim_fn);
-                                       }
-                                       (void)fclose(timetrim_st);
-                                   }
-                               }
-
-                               tot_adj -= ((tot_trim - timetrim)
-                                           * rint(tot_delta_ticks/CLK_TCK));
-                               timetrim = tot_trim;
-                       }
-
-                       hr_ticks = cur_ticks;
-                       hr_adj = 0;
-               }
-       }
-#endif /* sgi */
 }
 
 
diff -r 6e8fc13b70fc -r dbd664afd6a7 usr.sbin/timed/timed/globals.h
--- a/usr.sbin/timed/timed/globals.h    Sat Sep 01 23:54:57 2001 +0000
+++ b/usr.sbin/timed/timed/globals.h    Sun Sep 02 00:13:05 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: globals.h,v 1.6 2001/03/07 21:46:04 garbled Exp $      */
+/*     $NetBSD: globals.h,v 1.7 2001/09/02 00:13:06 reinoud Exp $      */
 
 /*-
  * Copyright (c) 1985 The Regents of the University of California.
@@ -35,10 +35,6 @@
  *     @(#)globals.h   8.1 (Berkeley) 6/6/93
  */
 
-#ifdef sgi
-#ident "$Revision: 1.6 $"
-#endif
-
 #include <sys/param.h>
 #include <sys/time.h>
 #include <sys/socket.h>
@@ -57,16 +53,8 @@
 #include <unistd.h>
 
 #include <protocols/timed.h>
-#ifdef sgi
-#include <bstring.h>
-#include <sys/clock.h>
-/* use the constant HZ instead of the function CLK_TCK */
-#undef CLK_TCK
-#define CLK_TCK HZ
-#else
 #define        SECHR   (60*60)
 #define        SECDAY  (24*SECHR)
-#endif /* sgi */
 
 extern int sock;
 
diff -r 6e8fc13b70fc -r dbd664afd6a7 usr.sbin/timed/timed/master.c
--- a/usr.sbin/timed/timed/master.c     Sat Sep 01 23:54:57 2001 +0000
+++ b/usr.sbin/timed/timed/master.c     Sun Sep 02 00:13:05 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: master.c,v 1.8 1997/10/17 14:19:26 lukem Exp $ */
+/*     $NetBSD: master.c,v 1.9 2001/09/02 00:13:06 reinoud Exp $       */
 
 /*-
  * Copyright (c) 1985, 1993 The Regents of the University of California.
@@ -38,25 +38,16 @@
 #if 0
 static char sccsid[] = "@(#)master.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: master.c,v 1.8 1997/10/17 14:19:26 lukem Exp $");
+__RCSID("$NetBSD: master.c,v 1.9 2001/09/02 00:13:06 reinoud Exp $");
 #endif
 #endif /* not lint */
 
-#ifdef sgi
-#ident "$Revision: 1.8 $"
-#endif
-
 #include "globals.h"
 #include <sys/file.h>
 #include <sys/types.h>
 #include <sys/times.h>
 #include <setjmp.h>
-#ifdef sgi
-#include <sys/schedctl.h>
-#include <utmpx.h>     /* includes utmp.h */
-#else
 #include <utmp.h>
-#endif /* sgi */
 
 #include "pathnames.h"
 
@@ -70,12 +61,7 @@
 
 static void mchgdate(struct tsp*);
 
-#ifdef sgi
-extern void    getutmpx(const struct utmp *, struct utmpx *);
-extern void    logwtmp(struct timeval*, struct timeval*);



Home | Main Index | Thread Index | Old Index