From d0ee2243ee1a21d455802c3bd65f842102e51d32 Mon Sep 17 00:00:00 2001 From: Eric Jackson Date: Tue, 18 Jun 2002 00:40:32 +0000 Subject: remove ifdef sgi code, and HAVENIS. sgi was pointless and this didnt even come close to compiling w/o HAVENIS deraadt@ ok --- usr.sbin/timed/timed/Makefile | 3 +- 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 | 108 +--------------------------- usr.sbin/timed/timed/globals.h | 14 +--- usr.sbin/timed/timed/master.c | 85 +--------------------- usr.sbin/timed/timed/measure.c | 13 +--- usr.sbin/timed/timed/networkdelta.c | 6 +- usr.sbin/timed/timed/pathnames.h | 7 +- usr.sbin/timed/timed/readmsg.c | 6 +- usr.sbin/timed/timed/slave.c | 39 +---------- usr.sbin/timed/timed/timed.c | 136 ++---------------------------------- 14 files changed, 20 insertions(+), 423 deletions(-) diff --git a/usr.sbin/timed/timed/Makefile b/usr.sbin/timed/timed/Makefile index 167d4adca84..b8d870c114f 100644 --- a/usr.sbin/timed/timed/Makefile +++ b/usr.sbin/timed/timed/Makefile @@ -1,10 +1,9 @@ -# $OpenBSD: Makefile,v 1.6 2001/04/07 20:00:15 ho Exp $ +# $OpenBSD: Makefile,v 1.7 2002/06/18 00:40:30 ericj Exp $ # # @(#)Makefile 5.12 (Berkeley) 5/7/93 # # optional flags are: MEASURE TESTING DEBUG -CFLAGS+=-DHAVENIS PROG= timed SRCS= acksend.c candidate.c correct.c master.c networkdelta.c readmsg.c \ slave.c timed.c byteorder.c measure.c cksum.c diff --git a/usr.sbin/timed/timed/acksend.c b/usr.sbin/timed/timed/acksend.c index ea139893b69..50ff567b0a9 100644 --- a/usr.sbin/timed/timed/acksend.c +++ b/usr.sbin/timed/timed/acksend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acksend.c,v 1.4 2001/05/05 05:10:04 mickey Exp $ */ +/* $OpenBSD: acksend.c,v 1.5 2002/06/18 00:40:30 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,17 +37,11 @@ static char sccsid[] = "@(#)acksend.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.4 $" -#endif - #include "globals.h" struct tsp *answer; -extern u_short sequence; - void xmit(int type, u_short seq, diff --git a/usr.sbin/timed/timed/byteorder.c b/usr.sbin/timed/timed/byteorder.c index 2d6692c1b8b..fbadf68b767 100644 --- a/usr.sbin/timed/timed/byteorder.c +++ b/usr.sbin/timed/timed/byteorder.c @@ -1,4 +1,4 @@ -/* $OpenBSD: byteorder.c,v 1.3 2001/05/05 05:10:04 mickey Exp $ */ +/* $OpenBSD: byteorder.c,v 1.4 2002/06/18 00:40:30 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,10 +37,6 @@ static char sccsid[] = "@(#)byteorder.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.3 $" -#endif - #include "globals.h" /* diff --git a/usr.sbin/timed/timed/candidate.c b/usr.sbin/timed/timed/candidate.c index cfa09ad13dc..08512767933 100644 --- a/usr.sbin/timed/timed/candidate.c +++ b/usr.sbin/timed/timed/candidate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: candidate.c,v 1.4 2001/05/05 05:10:04 mickey Exp $ */ +/* $OpenBSD: candidate.c,v 1.5 2002/06/18 00:40:30 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,10 +37,6 @@ static char sccsid[] = "@(#)candidate.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.4 $" -#endif - #include "globals.h" /* diff --git a/usr.sbin/timed/timed/cksum.c b/usr.sbin/timed/timed/cksum.c index b5172fbc6a6..a54cd2ce5c2 100644 --- a/usr.sbin/timed/timed/cksum.c +++ b/usr.sbin/timed/timed/cksum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cksum.c,v 1.3 2002/03/14 16:44:25 mpech Exp $ */ +/* $OpenBSD: cksum.c,v 1.4 2002/06/18 00:40:30 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,10 +37,6 @@ static char sccsid[] = "@(#)cksum.c 5.2 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.3 $" -#endif - #include /* diff --git a/usr.sbin/timed/timed/correct.c b/usr.sbin/timed/timed/correct.c index cf8c66ef3c1..4a725955f52 100644 --- a/usr.sbin/timed/timed/correct.c +++ b/usr.sbin/timed/timed/correct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: correct.c,v 1.6 2001/05/05 05:10:04 mickey Exp $ */ +/* $OpenBSD: correct.c,v 1.7 2002/06/18 00:40:30 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,17 +37,10 @@ static char sccsid[] = "@(#)correct.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.6 $" -#endif - #include "globals.h" #include #include #include -#ifdef sgi -#include -#endif /* sgi */ static void adjclock(struct timeval*); @@ -176,105 +169,6 @@ adjclock(struct timeval *corr) 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 --git a/usr.sbin/timed/timed/globals.h b/usr.sbin/timed/timed/globals.h index 6a085040870..e5511c451fa 100644 --- a/usr.sbin/timed/timed/globals.h +++ b/usr.sbin/timed/timed/globals.h @@ -1,4 +1,4 @@ -/* $OpenBSD: globals.h,v 1.4 2001/11/23 03:45:51 deraadt Exp $ */ +/* $OpenBSD: globals.h,v 1.5 2002/06/18 00:40:30 ericj Exp $ */ /*- * Copyright (c) 1985 The Regents of the University of California. @@ -35,10 +35,6 @@ * @(#)globals.h 5.1 (Berkeley) 5/11/93 */ -#ifdef sgi -#ident "$Revision: 1.4 $" -#endif - #include #include #include @@ -57,16 +53,8 @@ #include #include -#ifdef sgi -#include -#include -/* 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 errno; extern int sock; diff --git a/usr.sbin/timed/timed/master.c b/usr.sbin/timed/timed/master.c index 83320db1813..2992aacb8d0 100644 --- a/usr.sbin/timed/timed/master.c +++ b/usr.sbin/timed/timed/master.c @@ -1,4 +1,4 @@ -/* $OpenBSD: master.c,v 1.6 2001/05/05 05:10:04 mickey Exp $ */ +/* $OpenBSD: master.c,v 1.7 2002/06/18 00:40:31 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,22 +37,13 @@ static char sccsid[] = "@(#)master.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.6 $" -#endif - #include "globals.h" #include #include #include #include -#ifdef sgi -#include -#include /* includes utmp.h */ -#else #include #include -#endif /* sgi */ #include "pathnames.h" @@ -66,12 +57,6 @@ static int slvcount; /* slaves listening to our clock */ static void mchgdate(struct tsp*); -#ifdef sgi -extern void getutmpx(const struct utmp *, struct utmpx *); -extern void logwtmp(struct timeval*, struct timeval*); -#endif /* sgi */ - - /* * The main function of `master' is to periodically compute the differences * (deltas) between its clock and the clocks of the slaves, to compute the @@ -184,12 +169,8 @@ loop: /* * XXX check to see it is from ourself */ -#ifdef sgi - (void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec); -#else tmpt = msg->tsp_time.tv_sec; strlcpy(newdate, ctime(&tmpt), sizeof newdate); -#endif /* sgi */ if (!good_host_name(msg->tsp_name)) { syslog(LOG_NOTICE, "attempted date change by %s to %s", @@ -206,12 +187,8 @@ loop: case TSP_SETDATEREQ: if (!fromnet || fromnet->status != MASTER) break; -#ifdef sgi - (void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec); -#else tmpt = msg->tsp_time.tv_sec; strlcpy(newdate, ctime(&tmpt), sizeof newdate); -#endif /* sgi */ htp = findhost(msg->tsp_name); if (htp == 0) { syslog(LOG_ERR, @@ -392,18 +369,11 @@ mchgdate(struct tsp *msg) dictate = 3; synch(tvtomsround(ntime)); } else { -#ifdef sgi - if (0 > settimeofday(&msg->tsp_time, 0)) { - syslog(LOG_ERR, "settimeofday(): %m"); - } - logwtmp(&otime, &msg->tsp_time); -#else logwtmp("|", "date", ""); tmptv.tv_sec = msg->tsp_time.tv_sec; tmptv.tv_usec = msg->tsp_time.tv_usec; (void)settimeofday(&tmptv, 0); logwtmp("{", "date", ""); -#endif /* sgi */ spreadtime(); } @@ -421,20 +391,11 @@ synch(long mydelta) struct hosttbl *htp; int measure_status; struct timeval check, stop, wait; -#ifdef sgi - int pri; -#endif /* sgi */ if (slvcount > 0) { if (trace) fprintf(fd, "measurements starting at %s\n", date()); (void)gettimeofday(&check, 0); -#ifdef sgi - /* run fast to get good time */ - pri = schedctl(NDPRI,0,NDPHIMIN); - if (pri < 0) - syslog(LOG_ERR, "schedctl(): %m"); -#endif /* sgi */ for (htp = self.l_fwd; htp != &self; htp = htp->l_fwd) { if (htp->noanswer != 0) { measure_status = measure(500, 100, @@ -478,10 +439,6 @@ synch(long mydelta) (void)gettimeofday(&check, 0); } } -#ifdef sgi - if (pri >= 0) - (void)schedctl(NDPRI,0,pri); -#endif /* sgi */ if (trace) fprintf(fd, "measurements finished at %s\n", date()); } @@ -883,43 +840,3 @@ traceoff(char *msg) #endif trace = OFF; } - - -#ifdef sgi -void -logwtmp(struct timeval *otime, struct timeval *ntime) -{ - static struct utmp wtmp[2] = { - {"","",OTIME_MSG,0,OLD_TIME,0,0,0}, - {"","",NTIME_MSG,0,NEW_TIME,0,0,0} - }; - static char *wtmpfile = WTMP_FILE; - static struct utmpx wtmpx[2]; - int f; - - wtmp[0].ut_time = otime->tv_sec + (otime->tv_usec + 500000) / 1000000; - wtmp[1].ut_time = ntime->tv_sec + (ntime->tv_usec + 500000) / 1000000; - if (wtmp[0].ut_time == wtmp[1].ut_time) - return; - - setutent(); - (void)pututline(&wtmp[0]); - (void)pututline(&wtmp[1]); - endutent(); - if ((f = open(wtmpfile, O_WRONLY|O_APPEND)) >= 0) { - (void)write(f, (char *)wtmp, sizeof(wtmp)); - (void)close(f); - } - - /* - * convert the wtmp entries into utmpx format in wtmpx[0..1] - * and append to /var/adm/wtmpx to keep wtmp and wtmpx in sync. - */ - getutmpx(&wtmp[0], &wtmpx[0]); - getutmpx(&wtmp[1], &wtmpx[1]); - if ((f = open(WTMPX_FILE, O_WRONLY|O_APPEND)) >= 0) { - (void)write(f, (char *)wtmpx, sizeof(wtmpx)); - (void)close(f); - } -} -#endif /* sgi */ diff --git a/usr.sbin/timed/timed/measure.c b/usr.sbin/timed/timed/measure.c index 092a5bd7fca..9f2cb1c77f8 100644 --- a/usr.sbin/timed/timed/measure.c +++ b/usr.sbin/timed/timed/measure.c @@ -1,4 +1,4 @@ -/* $OpenBSD: measure.c,v 1.6 2002/03/14 16:44:25 mpech Exp $ */ +/* $OpenBSD: measure.c,v 1.7 2002/06/18 00:40:31 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,10 +37,6 @@ static char sccsid[] = "@(#)measure.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.6 $" -#endif - #include "globals.h" #include #include @@ -140,10 +136,6 @@ measure(u_long maxmsec, /* wait this many msec at most */ FD_ZERO(&ready); -#ifdef sgi - sginap(1); /* start at a clock tick */ -#endif /* sgi */ - (void)gettimeofday(&tdone, 0); mstotvround(&tout, maxmsec); timeradd(&tdone, &tout, &tdone); /* when we give up */ @@ -320,13 +312,12 @@ bail: void mstotvround(struct timeval *res, long x) { -#ifndef sgi if (x < 0) x = -((-x + 3)/5); else x = (x+3)/5; x *= 5; -#endif /* sgi */ + res->tv_sec = x/1000; res->tv_usec = (x-res->tv_sec*1000)*1000; if (res->tv_usec < 0) { diff --git a/usr.sbin/timed/timed/networkdelta.c b/usr.sbin/timed/timed/networkdelta.c index 18ea81f7500..ca3fb3ac9d8 100644 --- a/usr.sbin/timed/timed/networkdelta.c +++ b/usr.sbin/timed/timed/networkdelta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: networkdelta.c,v 1.4 2001/05/05 05:10:04 mickey Exp $ */ +/* $OpenBSD: networkdelta.c,v 1.5 2002/06/18 00:40:31 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,10 +37,6 @@ static char sccsid[] = "@(#)networkdelta.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.4 $" -#endif - #include "globals.h" static long median(float, float*, long*, long*, unsigned int); diff --git a/usr.sbin/timed/timed/pathnames.h b/usr.sbin/timed/timed/pathnames.h index 1345444f6f7..854e478366c 100644 --- a/usr.sbin/timed/timed/pathnames.h +++ b/usr.sbin/timed/timed/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.2 2001/04/07 20:00:16 ho Exp $ */ +/* $OpenBSD: pathnames.h,v 1.3 2002/06/18 00:40:31 ericj Exp $ */ /*- * Copyright (c) 1985 The Regents of the University of California. @@ -37,10 +37,5 @@ #include -#ifdef sgi -#define _PATH_MASTERLOG "/var/adm/timed.masterlog" -#define _PATH_TIMEDLOG "/var/adm/timed.log" -#else #define _PATH_MASTERLOG "/var/log/timed.masterlog" #define _PATH_TIMEDLOG "/var/log/timed.log" -#endif diff --git a/usr.sbin/timed/timed/readmsg.c b/usr.sbin/timed/timed/readmsg.c index 30bfe72a8f6..0ab208881f0 100644 --- a/usr.sbin/timed/timed/readmsg.c +++ b/usr.sbin/timed/timed/readmsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readmsg.c,v 1.9 2002/03/14 16:44:25 mpech Exp $ */ +/* $OpenBSD: readmsg.c,v 1.10 2002/06/18 00:40:31 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,10 +37,6 @@ static char sccsid[] = "@(#)readmsg.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.9 $" -#endif - #include "globals.h" extern char *tsptype[]; diff --git a/usr.sbin/timed/timed/slave.c b/usr.sbin/timed/timed/slave.c index b28db24eb45..cb206c27b10 100644 --- a/usr.sbin/timed/timed/slave.c +++ b/usr.sbin/timed/timed/slave.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slave.c,v 1.5 2001/05/05 05:10:05 mickey Exp $ */ +/* $OpenBSD: slave.c,v 1.6 2002/06/18 00:40:31 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -37,13 +37,11 @@ static char sccsid[] = "@(#)slave.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.5 $" -#endif - #include "globals.h" #include #include "pathnames.h" +#include +#include extern jmp_buf jmpenv; extern int Mflag; @@ -59,12 +57,6 @@ static void schgdate(struct tsp *, char *); static void setmaster(struct tsp *); static void answerdelay(void); -#ifdef sgi -extern void logwtmp(struct timeval *, struct timeval *); -#else -extern void logwtmp(char *, char *, char *); -#endif /* sgi */ - int slave() { @@ -260,10 +252,6 @@ loop: /* adjust time for residence on the queue */ (void)gettimeofday(&otime, 0); adj_msg_time(msg,&otime); -#ifdef sgi - (void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec); - (void)cftime(olddate, "%D %T", &otime.tv_sec); -#else /* * the following line is necessary due to syslog * calling ctime() which clobbers the static buffer @@ -271,7 +259,6 @@ loop: strlcpy(olddate, date(), sizeof olddate); tmpt = msg->tsp_time.tv_sec; strlcpy(newdate, ctime(&tmpt), sizeof newdate); -#endif /* sgi */ if (!good_host_name(msg->tsp_name)) { syslog(LOG_NOTICE, @@ -289,19 +276,11 @@ loop: */ synch(tvtomsround(ntime)); } else { -#ifdef sgi - if (0 > settimeofday(&msg->tsp_time, 0)) { - syslog(LOG_ERR,"settimeofdate(): %m"); - break; - } - logwtmp(&otime, &msg->tsp_time); -#else logwtmp("|", "date", ""); tmptv.tv_sec = msg->tsp_time.tv_sec; tmptv.tv_usec = msg->tsp_time.tv_usec; (void)settimeofday(&tmptv, 0); logwtmp("{", "date", ""); -#endif /* sgi */ syslog(LOG_NOTICE, "date changed by %s from %s", msg->tsp_name, olddate); @@ -360,24 +339,16 @@ loop: break; case TSP_SETDATE: -#ifdef sgi - (void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec); -#else tmpt = msg->tsp_time.tv_sec; strlcpy(newdate, ctime(&tmpt), sizeof newdate); -#endif /* sgi */ schgdate(msg, newdate); break; case TSP_SETDATEREQ: if (fromnet->status != MASTER) break; -#ifdef sgi - (void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec); -#else tmpt = msg->tsp_time.tv_sec; strlcpy(newdate, ctime(&tmpt), sizeof newdate); -#endif /* sgi */ htp = findhost(msg->tsp_name); if (0 == htp) { syslog(LOG_WARNING, @@ -711,9 +682,6 @@ schgdate(struct tsp *msg, char *newdate) static void answerdelay(void) { -#ifdef sgi - sginap(delay1); -#else struct timeval timeout; timeout.tv_sec = 0; @@ -722,5 +690,4 @@ answerdelay(void) (void)select(0, (fd_set *)NULL, (fd_set *)NULL, (fd_set *)NULL, &timeout); return; -#endif /* sgi */ } diff --git a/usr.sbin/timed/timed/timed.c b/usr.sbin/timed/timed/timed.c index 1763e81447a..8c9cf282d24 100644 --- a/usr.sbin/timed/timed/timed.c +++ b/usr.sbin/timed/timed/timed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timed.c,v 1.14 2002/03/14 16:44:25 mpech Exp $ */ +/* $OpenBSD: timed.c,v 1.15 2002/06/18 00:40:31 ericj Exp $ */ /*- * Copyright (c) 1985, 1993 The Regents of the University of California. @@ -43,10 +43,6 @@ char copyright[] = static char sccsid[] = "@(#)timed.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ -#ifdef sgi -#ident "$Revision: 1.14 $" -#endif /* sgi */ - #define TSPTYPES #include "globals.h" #include @@ -57,14 +53,7 @@ static char sccsid[] = "@(#)timed.c 5.1 (Berkeley) 5/11/93"; #include #include #include -#ifdef HAVENIS #include -#endif /* HAVENIS */ -#ifdef sgi -#include -#include -#include -#endif /* sgi */ int trace = 0; int sock, sock_raw = -1; @@ -109,18 +98,6 @@ static void checkignorednets(void); static void pickslavenet(struct netinfo *); static void add_good_host(const char*,char); -#ifdef sgi -char *timetrim_fn; -char *timetrim_wpat = "long timetrim = %ld;\ndouble tot_adj = %.0f;\ndouble tot_ticks = %.0f;\n/* timed version 2 */\n"; -char *timetrim_rpat = "long timetrim = %ld;\ndouble tot_adj = %lf;\ndouble tot_ticks = %lf;"; -long timetrim; -double tot_adj, hr_adj; /* totals in nsec */ -double tot_ticks, hr_ticks; - -int bufspace = 60*1024; -#endif - - /* * The timedaemons synchronize the clocks of hosts in a local area network. * One daemon runs as master, all the others as slaves. The master @@ -158,21 +135,9 @@ main(int argc, char **argv) int c; extern char *optarg; extern int optind, opterr; -#ifdef sgi - FILE *timetrim_st; -#endif #define IN_MSG "timed: -i and -n make no sense together\n" -#ifdef sgi - struct tms tms; -#define USAGE "timed: [-dtM] [-i net|-n net] [-F host1 host2 ...] [-G netgp] [-P trimfile]\n" -#else -#ifdef HAVENIS #define USAGE "timed: [-dtM] [-i net|-n net] [-F host1 host2 ...] [-G netgp]\n" -#else -#define USAGE "timed: [-dtM] [-i net|-n net] [-F host1 host2 ...]\n" -#endif /* HAVENIS */ -#endif /* sgi */ ntip = NULL; @@ -180,16 +145,8 @@ main(int argc, char **argv) nflag = OFF; iflag = OFF; -#ifdef sgi - if (0 > syssgi(SGI_GETTIMETRIM, &timetrim)) { - perror("timed: syssgi(GETTIMETRIM)"); - timetrim = 0; - } - tot_ticks = hr_ticks = times(&tms); -#endif /* sgi */ - opterr = 0; - while ((c = getopt(argc, argv, "Mtdn:i:F:G:P:")) != -1) { + while ((c = getopt(argc, argv, "Mtdn:i:F:G:")) != -1) { switch (c) { case 'M': Mflag = 1; @@ -235,11 +192,6 @@ main(int argc, char **argv) } goodgroup = optarg; break; -#ifdef sgi - case 'P': - timetrim_fn = optarg; - break; -#endif /* sgi */ default: fprintf(stderr, USAGE); @@ -252,47 +204,8 @@ main(int argc, char **argv) exit(1); } -#ifdef sgi - if (timetrim_fn == 0) { - ; - } else if (0 == (timetrim_st = fopen(timetrim_fn, "r+"))) { - if (errno != ENOENT) { - (void)fprintf(stderr,"timed: "); - perror(timetrim_fn); - timetrim_fn = 0; - } - } else { - int i; - long trim; - double adj, ticks; - - i = fscanf(timetrim_st, timetrim_rpat, - &trim, &adj, &ticks); - if (i < 1 - || trim > MAX_TRIM - || trim < -MAX_TRIM - || i == 2 - || (i == 3 - && trim != rint(adj*CLK_TCK/ticks))) { - if (trace && i != EOF) - (void)fprintf(stderr, - "timed: unrecognized contents in %s\n", - timetrim_fn); - } else { - if (0 > syssgi(SGI_SETTIMETRIM, - trim)) { - perror("timed: syssgi(SETTIMETRIM)"); - } else { - timetrim = trim; - } - if (i == 3) - tot_ticks -= ticks; - } - (void)fclose(timetrim_st); - } -#endif /* sgi */ - - /* If we care about which machine is the master, then we must + /* + * If we care about which machine is the master, then we must * be willing to be a master */ if (0 != goodgroup || 0 != goodhosts) @@ -338,28 +251,16 @@ main(int argc, char **argv) perror("bind"); exit(1); } -#ifdef sgi - /* - * handle many slaves with our buffer - */ - if (0 > setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char*)&bufspace, - sizeof(bufspace))) { - perror("setsockopt"); - exit(1); - } -#endif /* sgi */ /* choose a unique seed for random number generation */ (void)gettimeofday(&ntime, 0); sequence = arc4random(); /* initial seq number */ -#ifndef sgi /* rounds kernel variable time to multiple of 5 ms. */ ntime.tv_sec = 0; ntime.tv_usec = -((ntime.tv_usec/1000) % 5) * 1000; (void)adjtime(&ntime, (struct timeval *)0); -#endif /* sgi */ for (nt = nets; nt; nt = nt->next) { nentp = getnetbyname(nt->name); @@ -413,11 +314,7 @@ main(int argc, char **argv) } ntp = NULL; -#ifdef sgi -#define size(p) (sizeof(*ifr) - sizeof(ifr->ifr_name)) /* XXX hack. kludge */ -#else #define size(p) max((p).sa_len, sizeof(p)) -#endif cplim = inbuf + ifc.ifc_len; /*skip over if's with big ifr_addr's */ for (cp = inbuf; cp < cplim; cp += sizeof (ifr->ifr_name) + size(ifr->ifr_addr)) { @@ -502,27 +399,15 @@ main(int argc, char **argv) } free(inbuf); -#ifdef sgi - (void)schedctl(RENICE,0,10); /* run fast to get good time */ - - /* ticks to delay before responding to a broadcast */ - delay1 = casual(0, CLK_TCK/10); -#else - /* microseconds to delay before responding to a broadcast */ delay1 = casual(1, 100*1000); -#endif /* sgi */ /* election timer delay in secs. */ delay2 = casual(MINTOUT, MAXTOUT); -#ifdef sgi - (void)_daemonize(debug ? _DF_NOFORK|_DF_NOCHDIR : 0, sock, -1, -1); -#else if (!debug) daemon(debug, 0); -#endif /* sgi */ if (trace) traceon(); @@ -849,21 +734,12 @@ casual(long inf, long sup) char * date() { -#ifdef sgi - struct timeval tv; - static char tm[32]; - - (void)gettimeofday(&tv, (struct timezone *)0); - (void)cftime(tm, "%D %T", &tv.tv_sec); - return (tm); -#else struct timeval tv; time_t t; (void)gettimeofday(&tv, (struct timezone *)0); t = tv.tv_sec; return (ctime(&t)); -#endif /* sgi */ } void @@ -916,11 +792,9 @@ get_goodgroup(int force) # define NG_DELAY (30*60*CLK_TCK) /* 30 minutes */ static unsigned long last_update = -NG_DELAY; unsigned long new_update; -#ifdef HAVENIS struct hosttbl *htp; struct goodhost *ghp, **ghpp; const char *mach, *usr, *dom; -#endif struct tms tm; @@ -947,7 +821,6 @@ get_goodgroup(int force) } } -#ifdef HAVENIS /* quit now if we are not one of the trusted masters */ if (!innetgr(goodgroup, &hostname[0], 0,0)) { @@ -972,7 +845,6 @@ get_goodgroup(int force) for (htp = self.l_fwd; htp != &self; htp = htp->l_fwd) { htp->good = good_host_name(&htp->name[0]); } -#endif /* HAVENIS */ } -- cgit v1.2.3