[Midnightbsd-cvs] src [10323] trunk/usr.sbin/timed/timed/timed.c: update
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Jun 3 15:47:02 EDT 2018
Revision: 10323
http://svnweb.midnightbsd.org/src/?rev=10323
Author: laffer1
Date: 2018-06-03 15:47:01 -0400 (Sun, 03 Jun 2018)
Log Message:
-----------
update
Modified Paths:
--------------
trunk/usr.sbin/timed/timed/acksend.c
trunk/usr.sbin/timed/timed/byteorder.c
trunk/usr.sbin/timed/timed/candidate.c
trunk/usr.sbin/timed/timed/cksum.c
trunk/usr.sbin/timed/timed/correct.c
trunk/usr.sbin/timed/timed/master.c
trunk/usr.sbin/timed/timed/measure.c
trunk/usr.sbin/timed/timed/networkdelta.c
trunk/usr.sbin/timed/timed/pathnames.h
trunk/usr.sbin/timed/timed/readmsg.c
trunk/usr.sbin/timed/timed/slave.c
trunk/usr.sbin/timed/timed/timed.8
trunk/usr.sbin/timed/timed/timed.c
Property Changed:
----------------
trunk/usr.sbin/timed/timed/CHANGES
trunk/usr.sbin/timed/timed/timed.8
Index: trunk/usr.sbin/timed/timed/CHANGES
===================================================================
--- trunk/usr.sbin/timed/timed/CHANGES 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/CHANGES 2018-06-03 19:47:01 UTC (rev 10323)
Property changes on: trunk/usr.sbin/timed/timed/CHANGES
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/timed/timed/acksend.c
===================================================================
--- trunk/usr.sbin/timed/timed/acksend.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/acksend.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
static char sccsid[] = "@(#)acksend.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/acksend.c 246209 2013-02-01 14:26:54Z charnier $";
#endif /* not lint */
#include "globals.h"
@@ -42,10 +43,7 @@
extern u_short sequence;
void
-xmit(type, seq, addr)
- int type;
- u_int seq;
- struct sockaddr_in *addr;
+xmit(int type, u_int seq, struct sockaddr_in *addr)
{
static struct tsp msg;
@@ -68,15 +66,15 @@
*
* Because this function calls readmsg(), none of its args may be in
* a message provided by readmsg().
+ * message this message
+ * addr to here
+ * ack look for this ack
+ * net receive from this network
+ * bad 1=losing patience
*/
struct tsp *
-acksend(message, addr, name, ack, net, bad)
- struct tsp *message; /* this message */
- struct sockaddr_in *addr; /* to here */
- char *name;
- int ack; /* look for this ack */
- struct netinfo *net; /* receive from this network */
- int bad; /* 1=losing patience */
+acksend(struct tsp *message, struct sockaddr_in *addr, char *name,
+ int ack, struct netinfo *net, int bad)
{
struct timeval twait;
int count;
Modified: trunk/usr.sbin/timed/timed/byteorder.c
===================================================================
--- trunk/usr.sbin/timed/timed/byteorder.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/byteorder.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
static char sccsid[] = "@(#)byteorder.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/byteorder.c 246209 2013-02-01 14:26:54Z charnier $";
#endif /* not lint */
#include "globals.h"
@@ -42,8 +43,7 @@
* messages. Protocol is defined in /usr/include/protocols/timed.h
*/
void
-bytenetorder(ptr)
- struct tsp *ptr;
+bytenetorder(struct tsp *ptr)
{
ptr->tsp_seq = htons((u_short)ptr->tsp_seq);
switch (ptr->tsp_type) {
@@ -62,8 +62,7 @@
}
void
-bytehostorder(ptr)
- struct tsp *ptr;
+bytehostorder(struct tsp *ptr)
{
ptr->tsp_seq = ntohs((u_short)ptr->tsp_seq);
switch (ptr->tsp_type) {
Modified: trunk/usr.sbin/timed/timed/candidate.c
===================================================================
--- trunk/usr.sbin/timed/timed/candidate.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/candidate.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
static char sccsid[] = "@(#)candidate.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/candidate.c 246209 2013-02-01 14:26:54Z charnier $";
#endif /* not lint */
#include "globals.h"
@@ -44,8 +45,7 @@
* candidate sends an election request, the candidature is withdrawn.
*/
int
-election(net)
- struct netinfo *net;
+election(struct netinfo *net)
{
struct tsp *resp, msg;
struct timeval then, wait;
Modified: trunk/usr.sbin/timed/timed/cksum.c
===================================================================
--- trunk/usr.sbin/timed/timed/cksum.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/cksum.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
static char sccsid[] = "@(#)cksum.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/cksum.c 246209 2013-02-01 14:26:54Z charnier $";
#endif /* not lint */
#include <sys/types.h>
@@ -49,9 +50,7 @@
* worry about carries except at the end.
*/
int
-in_cksum(addr, len)
- u_short *addr;
- int len;
+in_cksum(u_short *addr, int len)
{
register int nleft = len;
register u_short *w = addr;
Modified: trunk/usr.sbin/timed/timed/correct.c
===================================================================
--- trunk/usr.sbin/timed/timed/correct.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/correct.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
static char sccsid[] = "@(#)correct.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/correct.c 246209 2013-02-01 14:26:54Z charnier $";
#endif /* not lint */
#include "globals.h"
@@ -47,8 +48,7 @@
* own
*/
void
-correct(avdelta)
- long avdelta;
+correct(long avdelta)
{
struct hosttbl *htp;
int corr;
@@ -112,8 +112,7 @@
static void
-adjclock(corr)
- struct timeval *corr;
+adjclock(struct timeval *corr)
{
static int passes = 0;
static int smoother = 0;
@@ -176,9 +175,7 @@
* spent in the queue
*/
void
-adj_msg_time(msg, now)
- struct tsp *msg;
- struct timeval *now;
+adj_msg_time(struct tsp *msg, struct timeval *now)
{
msg->tsp_time.tv_sec += (now->tv_sec - from_when.tv_sec);
msg->tsp_time.tv_usec += (now->tv_usec - from_when.tv_usec);
Modified: trunk/usr.sbin/timed/timed/master.c
===================================================================
--- trunk/usr.sbin/timed/timed/master.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/master.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
static char sccsid[] = "@(#)master.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/master.c 300271 2016-05-20 06:33:02Z truckman $";
#endif /* not lint */
#include "globals.h"
@@ -63,7 +64,7 @@
* takes the appropriate action.
*/
int
-master()
+master(void)
{
struct hosttbl *htp;
long pollingtime;
@@ -85,7 +86,7 @@
if (ntp->status == MASTER)
masterup(ntp);
}
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
pollingtime = ntime.tv_sec+3;
if (justquit)
polls = 0;
@@ -96,7 +97,7 @@
* to update all timers.
*/
loop:
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
wait.tv_sec = pollingtime - ntime.tv_sec;
if (wait.tv_sec < 0)
wait.tv_sec = 0;
@@ -103,7 +104,7 @@
wait.tv_usec = 0;
msg = readmsg(TSP_ANY, ANYADDR, &wait, 0);
if (!msg) {
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
if (ntime.tv_sec >= pollingtime) {
pollingtime = ntime.tv_sec + SAMPLEINTVL;
get_goodgroup(0);
@@ -175,7 +176,7 @@
}
mchgdate(msg);
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
pollingtime = ntime.tv_sec + SAMPLEINTVL;
break;
@@ -203,7 +204,7 @@
}
mchgdate(msg);
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
pollingtime = ntime.tv_sec + SAMPLEINTVL;
break;
@@ -284,7 +285,7 @@
* do not want to call synch() while waiting
* to be killed!
*/
- (void)gettimeofday(&ntime, (struct timezone *)0);
+ (void)gettimeofday(&ntime, NULL);
pollingtime = ntime.tv_sec + SAMPLEINTVL;
break;
@@ -339,8 +340,7 @@
* change the system date on the master
*/
static void
-mchgdate(msg)
- struct tsp *msg;
+mchgdate(struct tsp *msg)
{
char tname[MAXHOSTNAMELEN];
char olddate[32];
@@ -354,7 +354,7 @@
(void)strcpy(olddate, date());
/* adjust time for residence on the queue */
- (void)gettimeofday(&otime, 0);
+ (void)gettimeofday(&otime, NULL);
adj_msg_time(msg,&otime);
tmptv.tv_sec = msg->tsp_time.tv_sec;
@@ -368,11 +368,11 @@
synch(tvtomsround(ntime));
} else {
utx.ut_type = OLD_TIME;
- gettimeofday(&utx.ut_tv, NULL);
+ (void)gettimeofday(&utx.ut_tv, NULL);
pututxline(&utx);
(void)settimeofday(&tmptv, 0);
utx.ut_type = NEW_TIME;
- gettimeofday(&utx.ut_tv, NULL);
+ (void)gettimeofday(&utx.ut_tv, NULL);
pututxline(&utx);
spreadtime();
}
@@ -386,8 +386,7 @@
* synchronize all of the slaves
*/
void
-synch(mydelta)
- long mydelta;
+synch(long mydelta)
{
struct hosttbl *htp;
int measure_status;
@@ -396,7 +395,7 @@
if (slvcount > 0) {
if (trace)
fprintf(fd, "measurements starting at %s\n", date());
- (void)gettimeofday(&check, 0);
+ (void)gettimeofday(&check, NULL);
for (htp = self.l_fwd; htp != &self; htp = htp->l_fwd) {
if (htp->noanswer != 0) {
measure_status = measure(500, 100,
@@ -424,7 +423,7 @@
} else {
htp->delta = measure_delta;
}
- (void)gettimeofday(&stop, 0);
+ (void)gettimeofday(&stop, NULL);
timevalsub(&stop, &stop, &check);
if (stop.tv_sec >= 1) {
if (trace)
@@ -437,7 +436,7 @@
if (0 != readmsg(TSP_TRACEON,ANYADDR,
&wait,0))
traceon();
- (void)gettimeofday(&check, 0);
+ (void)gettimeofday(&check, NULL);
}
}
if (trace)
@@ -460,7 +459,7 @@
* has received the command to set the network time
*/
void
-spreadtime()
+spreadtime(void)
{
struct hosttbl *htp;
struct tsp to;
@@ -474,7 +473,7 @@
for (htp = self.l_fwd; htp != &self; htp = htp->l_fwd) {
to.tsp_type = TSP_SETTIME;
(void)strcpy(to.tsp_name, hostname);
- (void)gettimeofday(&tmptv, 0);
+ (void)gettimeofday(&tmptv, NULL);
to.tsp_time.tv_sec = tmptv.tv_sec;
to.tsp_time.tv_usec = tmptv.tv_usec;
answer = acksend(&to, &htp->addr, htp->name,
@@ -499,8 +498,7 @@
}
void
-prthp(delta)
- clock_t delta;
+prthp(clock_t delta)
{
static time_t next_time;
time_t this_time;
@@ -538,8 +536,7 @@
struct hosttbl * /* answer or 0 */
-findhost(name)
- char *name;
+findhost(char *name)
{
int i, j;
struct hosttbl *htp;
@@ -565,10 +562,7 @@
* add a host to the list of controlled machines if not already there
*/
struct hosttbl *
-addmach(name, addr, ntp)
- char *name;
- struct sockaddr_in *addr;
- struct netinfo *ntp;
+addmach(char *name, struct sockaddr_in *addr, struct netinfo *ntp)
{
struct hosttbl *ret, *p, *b, *f;
@@ -630,7 +624,7 @@
}
ret->addr = *addr;
ret->ntp = ntp;
- (void)strncpy(ret->name, name, sizeof(ret->name));
+ (void)strlcpy(ret->name, name, sizeof(ret->name));
ret->good = good_host_name(name);
ret->l_fwd = &self;
ret->l_bak = self.l_bak;
@@ -654,8 +648,7 @@
* remove the machine with the given index in the host table.
*/
struct hosttbl *
-remmach(htp)
- struct hosttbl *htp;
+remmach(struct hosttbl *htp)
{
struct hosttbl *lprv, *hnxt, *f, *b;
@@ -706,8 +699,7 @@
* given network.
*/
void
-rmnetmachs(ntp)
- struct netinfo *ntp;
+rmnetmachs(struct netinfo *ntp)
{
struct hosttbl *htp;
@@ -722,8 +714,7 @@
}
void
-masterup(net)
- struct netinfo *net;
+masterup(struct netinfo *net)
{
xmit(TSP_MASTERUP, 0, &net->dest_addr);
@@ -732,12 +723,11 @@
* we do not tell them to start using our time, before we have
* found a good master.
*/
- (void)gettimeofday(&net->slvwait, 0);
+ (void)gettimeofday(&net->slvwait, NULL);
}
void
-newslave(msg)
- struct tsp *msg;
+newslave(struct tsp *msg)
{
struct hosttbl *htp;
struct tsp *answer, to;
@@ -755,12 +745,12 @@
* If we are stable, send our time to the slave.
* Do not go crazy if the date has been changed.
*/
- (void)gettimeofday(&now, 0);
+ (void)gettimeofday(&now, NULL);
if (now.tv_sec >= fromnet->slvwait.tv_sec+3
|| now.tv_sec < fromnet->slvwait.tv_sec) {
to.tsp_type = TSP_SETTIME;
(void)strcpy(to.tsp_name, hostname);
- (void)gettimeofday(&tmptv, 0);
+ (void)gettimeofday(&tmptv, NULL);
to.tsp_time.tv_sec = tmptv.tv_sec;
to.tsp_time.tv_usec = tmptv.tv_usec;
answer = acksend(&to, &htp->addr,
@@ -782,8 +772,7 @@
* react to a TSP_QUIT:
*/
void
-doquit(msg)
- struct tsp *msg;
+doquit(struct tsp *msg)
{
if (fromnet->status == MASTER) {
if (!good_host_name(msg->tsp_name)) {
@@ -814,7 +803,7 @@
}
void
-traceon()
+traceon(void)
{
if (!fd) {
fd = fopen(_PATH_TIMEDLOG, "w");
@@ -832,8 +821,7 @@
void
-traceoff(msg)
- char *msg;
+traceoff(char *msg)
{
get_goodgroup(1);
setstatus();
Modified: trunk/usr.sbin/timed/timed/measure.c
===================================================================
--- trunk/usr.sbin/timed/timed/measure.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/measure.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
static char sccsid[] = "@(#)measure.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/measure.c 246209 2013-02-01 14:26:54Z charnier $";
#endif /* not lint */
#include "globals.h"
@@ -56,14 +57,12 @@
/*
* Measures the differences between machines' clocks using
* ICMP timestamp messages.
+ * maxmsec wait this many msec at most
+ * wmsec msec to wait for an answer
+ * print print complaints on stderr
*/
int /* status val defined in globals.h */
-measure(maxmsec, wmsec, hname, addr, print)
- u_long maxmsec; /* wait this many msec at most */
- u_long wmsec; /* msec to wait for an answer */
- char *hname;
- struct sockaddr_in *addr;
- int print; /* print complaints on stderr */
+measure(u_long maxmsec, u_long wmsec, char *hname, struct sockaddr_in *addr, int print)
{
int length;
int measure_status;
@@ -128,7 +127,7 @@
FD_ZERO(&ready);
- (void)gettimeofday(&tdone, 0);
+ (void)gettimeofday(&tdone, NULL);
mstotvround(&tout, maxmsec);
timevaladd(&tdone, &tout); /* when we give up */
@@ -136,7 +135,7 @@
rcvcount = 0;
while (rcvcount < MSGS) {
- (void)gettimeofday(&tcur, 0);
+ (void)gettimeofday(&tcur, NULL);
/*
* keep sending until we have sent the max
@@ -173,7 +172,7 @@
FD_SET(sock_raw, &ready);
count = select(sock_raw+1, &ready, (fd_set *)0,
(fd_set *)0, &tout);
- (void)gettimeofday(&tcur, (struct timezone *)0);
+ (void)gettimeofday(&tcur, NULL);
if (count <= 0)
break;
@@ -292,9 +291,7 @@
* round a number of milliseconds into a struct timeval
*/
void
-mstotvround(res, x)
- struct timeval *res;
- long x;
+mstotvround(struct timeval *res, long x)
{
if (x < 0)
x = -((-x + 3)/5);
@@ -310,8 +307,7 @@
}
void
-timevaladd(tv1, tv2)
- struct timeval *tv1, *tv2;
+timevaladd(struct timeval *tv1, struct timeval *tv2)
{
tv1->tv_sec += tv2->tv_sec;
tv1->tv_usec += tv2->tv_usec;
@@ -326,8 +322,7 @@
}
void
-timevalsub(res, tv1, tv2)
- struct timeval *res, *tv1, *tv2;
+timevalsub(struct timeval *res, struct timeval *tv1, struct timeval *tv2)
{
res->tv_sec = tv1->tv_sec - tv2->tv_sec;
res->tv_usec = tv1->tv_usec - tv2->tv_usec;
Modified: trunk/usr.sbin/timed/timed/networkdelta.c
===================================================================
--- trunk/usr.sbin/timed/timed/networkdelta.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/networkdelta.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
static char sccsid[] = "@(#)networkdelta.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/networkdelta.c 246209 2013-02-01 14:26:54Z charnier $";
#endif /* not lint */
#include "globals.h"
@@ -62,7 +63,7 @@
* bad values.
*/
long
-networkdelta()
+networkdelta(void)
{
struct hosttbl *htp;
long med;
Modified: trunk/usr.sbin/timed/timed/pathnames.h
===================================================================
--- trunk/usr.sbin/timed/timed/pathnames.h 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/pathnames.h 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -28,7 +29,7 @@
*
* @(#)pathnames.h 8.1 (Berkeley) 6/6/93
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.sbin/timed/timed/pathnames.h 216372 2010-12-11 09:38:12Z joel $
*/
#include <paths.h>
Modified: trunk/usr.sbin/timed/timed/readmsg.c
===================================================================
--- trunk/usr.sbin/timed/timed/readmsg.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/readmsg.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,13 +33,12 @@
static char sccsid[] = "@(#)readmsg.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/readmsg.c 246209 2013-02-01 14:26:54Z charnier $";
#endif /* not lint */
+#define TSPTYPES
#include "globals.h"
-extern char *tsptype[];
-
/*
* LOOKAT checks if the message is of the requested type and comes from
* the right machine, returning 1 in case of affirmative answer
@@ -70,11 +70,7 @@
*/
struct tsp *
-readmsg(type, machfrom, intvl, netfrom)
- int type;
- char *machfrom;
- struct timeval *intvl;
- struct netinfo *netfrom;
+readmsg(int type, char *machfrom, struct timeval *intvl, struct netinfo *netfrom)
{
int length;
fd_set ready;
@@ -169,11 +165,11 @@
* right one, return it, otherwise insert it in the linked list.
*/
- (void)gettimeofday(&rtout, 0);
+ (void)gettimeofday(&rtout, NULL);
timevaladd(&rtout, intvl);
FD_ZERO(&ready);
for (;;) {
- (void)gettimeofday(&rtime, 0);
+ (void)gettimeofday(&rtime, NULL);
timevalsub(&rwait, &rtout, &rtime);
if (rwait.tv_sec < 0)
rwait.tv_sec = rwait.tv_usec = 0;
@@ -220,7 +216,7 @@
inet_ntoa(from.sin_addr));
continue;
}
- (void)gettimeofday(&from_when, (struct timezone *)0);
+ (void)gettimeofday(&from_when, NULL);
bytehostorder(&msgin);
if (msgin.tsp_vers > TSPVERSION) {
@@ -343,7 +339,7 @@
* only the type ACK is to be sent by a slave
*/
void
-slaveack()
+slaveack(void)
{
switch(msgin.tsp_type) {
@@ -375,7 +371,7 @@
* These packets should be acknowledged.
*/
void
-ignoreack()
+ignoreack(void)
{
switch(msgin.tsp_type) {
@@ -403,7 +399,7 @@
* to the messages received by a master
*/
void
-masterack()
+masterack(void)
{
struct tsp resp;
@@ -446,9 +442,7 @@
* Print a TSP message
*/
void
-print(msg, addr)
- struct tsp *msg;
- struct sockaddr_in *addr;
+print(struct tsp *msg, struct sockaddr_in *addr)
{
char tm[26];
time_t tsp_time_sec;
Modified: trunk/usr.sbin/timed/timed/slave.c
===================================================================
--- trunk/usr.sbin/timed/timed/slave.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/slave.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
static char sccsid[] = "@(#)slave.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/usr.sbin/timed/timed/slave.c 246209 2013-02-01 14:26:54Z charnier $";
#endif /* not lint */
#include "globals.h"
@@ -55,7 +56,7 @@
static void answerdelay(void);
int
-slave()
+slave(void)
{
int tries;
long electiontime, refusetime, looktime, looptime, adjtime;
@@ -83,7 +84,7 @@
refusetime = 0;
adjtime = 0;
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
electiontime = ntime.tv_sec + delay2;
fastelection = ntime.tv_sec + FASTTOUT;
if (justquit)
@@ -103,7 +104,7 @@
loop:
get_goodgroup(0);
- (void)gettimeofday(&ntime, (struct timezone *)0);
+ (void)gettimeofday(&ntime, NULL);
if (ntime.tv_sec > electiontime) {
if (trace)
fprintf(fd, "election timer expired\n");
@@ -132,7 +133,7 @@
makeslave(slavenet); /* prune extras */
setstatus();
}
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
looktime = ntime.tv_sec + delay2;
}
if (ntime.tv_sec >= looptime) {
@@ -153,7 +154,7 @@
}
}
}
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
looptime = ntime.tv_sec + delay2;
}
@@ -225,7 +226,7 @@
* Otherwise the clocks can race until the loop
* is found.
*/
- (void)gettimeofday(&otime, 0);
+ (void)gettimeofday(&otime, NULL);
if (adjtime < otime.tv_sec)
looptime -= (looptime-otime.tv_sec)/2 + 1;
@@ -234,7 +235,7 @@
seq = msg->tsp_seq;
synch(tvtomsround(msg->tsp_time));
}
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
electiontime = ntime.tv_sec + delay2;
fastelection = ntime.tv_sec + FASTTOUT;
adjtime = ntime.tv_sec + SAMPLEINTVL*2;
@@ -248,7 +249,7 @@
seq = msg->tsp_seq;
/* adjust time for residence on the queue */
- (void)gettimeofday(&otime, 0);
+ (void)gettimeofday(&otime, NULL);
adj_msg_time(msg,&otime);
/*
* the following line is necessary due to syslog
@@ -289,7 +290,7 @@
if (status & MASTER)
spreadtime();
}
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
electiontime = ntime.tv_sec + delay2;
fastelection = ntime.tv_sec + FASTTOUT;
@@ -327,7 +328,7 @@
setstatus();
answerdelay();
xmit(TSP_SLAVEUP, 0, &from);
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
electiontime = ntime.tv_sec + delay2;
fastelection = ntime.tv_sec + FASTTOUT;
refusetime = 0;
@@ -336,7 +337,7 @@
case TSP_MASTERREQ:
if (fromnet->status != SLAVE)
break;
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
electiontime = ntime.tv_sec + delay2;
break;
@@ -381,7 +382,7 @@
case TSP_ELECTION:
if (fromnet->status == SLAVE) {
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
electiontime = ntime.tv_sec + delay2;
fastelection = ntime.tv_sec + FASTTOUT;
seq = 0;
@@ -538,7 +539,7 @@
electiontime = 0;
}
}
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
looptime = ntime.tv_sec + FASTTOUT;
} else {
if (msg->tsp_hopcnt-- < 1)
@@ -590,7 +591,7 @@
(void)remmach(htp);
}
}
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
looptime = ntime.tv_sec + FASTTOUT;
}
break;
@@ -610,8 +611,7 @@
* tell the world who our master is
*/
static void
-setmaster(msg)
- struct tsp *msg;
+setmaster(struct tsp *msg)
{
if (slavenet
&& (slavenet != old_slavenet
@@ -640,9 +640,7 @@
* handle date change request on a slave
*/
static void
-schgdate(msg, newdate)
- struct tsp *msg;
- char *newdate;
+schgdate(struct tsp *msg, char *newdate)
{
struct tsp to;
u_short seq;
@@ -660,7 +658,7 @@
msg->tsp_name, newdate);
/* adjust time for residence on the queue */
- (void)gettimeofday(&otime, 0);
+ (void)gettimeofday(&otime, NULL);
adj_msg_time(msg, &otime);
to.tsp_type = TSP_SETDATEREQ;
@@ -680,7 +678,7 @@
* contention and likely collisions.
*/
static void
-answerdelay()
+answerdelay(void)
{
struct timeval timeout;
Modified: trunk/usr.sbin/timed/timed/timed.8
===================================================================
--- trunk/usr.sbin/timed/timed/timed.8 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/timed.8 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -26,7 +27,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)timed.8 8.1 (Berkeley) 6/6/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.sbin/timed/timed/timed.8 249771 2013-04-22 18:31:39Z joel $
.\"
.Dd February 11, 2008
.Dt TIMED 8
@@ -44,7 +45,7 @@
.Nm
utility is a time server daemon
which is normally invoked at boot time from the
-.Xr rc.network 8
+.Xr rc.conf 5
file.
It synchronizes the host's time with the time of other
machines, which are also running
Property changes on: trunk/usr.sbin/timed/timed/timed.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/timed/timed/timed.c
===================================================================
--- trunk/usr.sbin/timed/timed/timed.c 2018-06-03 19:14:15 UTC (rev 10322)
+++ trunk/usr.sbin/timed/timed/timed.c 2018-06-03 19:47:01 UTC (rev 10323)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -40,9 +41,8 @@
#endif
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.sbin/timed/timed/timed.c 246209 2013-02-01 14:26:54Z charnier $");
-#define TSPTYPES
#include "globals.h"
#include <net/if.h>
#include <sys/file.h>
@@ -111,9 +111,7 @@
* overhauled at Silicon Graphics
*/
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int on;
int ret;
@@ -233,7 +231,7 @@
}
/* choose a unique seed for random number generation */
- (void)gettimeofday(&ntime, 0);
+ (void)gettimeofday(&ntime, NULL);
srandom(ntime.tv_sec + ntime.tv_usec);
sequence = random(); /* initial seq number */
@@ -435,7 +433,7 @@
}
static void
-usage()
+usage(void)
{
#ifdef HAVENIS
fprintf(stderr,
@@ -451,10 +449,7 @@
* suppress an upstart, untrustworthy, self-appointed master
*/
void
-suppress(addr, name,net)
- struct sockaddr_in *addr;
- char *name;
- struct netinfo *net;
+suppress(struct sockaddr_in *addr, char *name, struct netinfo *net)
{
struct sockaddr_in tgt;
char tname[MAXHOSTNAMELEN];
@@ -479,8 +474,7 @@
}
void
-lookformaster(ntp)
- struct netinfo *ntp;
+lookformaster(struct netinfo *ntp)
{
struct tsp resp, conflict, *answer;
struct timeval ntime;
@@ -579,7 +573,7 @@
* networks;
*/
void
-setstatus()
+setstatus(void)
{
struct netinfo *ntp;
@@ -632,8 +626,7 @@
}
void
-makeslave(net)
- struct netinfo *net;
+makeslave(struct netinfo *net)
{
register struct netinfo *ntp;
@@ -648,7 +641,7 @@
* Try to become master over ignored nets..
*/
static void
-checkignorednets()
+checkignorednets(void)
{
register struct netinfo *ntp;
@@ -670,8 +663,7 @@
* Take a hint about for a good network.
*/
static void
-pickslavenet(ntp)
- struct netinfo *ntp;
+pickslavenet(struct netinfo *ntp)
{
if (slavenet != 0 && slavenet->status == SLAVE) {
makeslave(slavenet); /* prune extras */
@@ -691,8 +683,7 @@
* returns a random number in the range [inf, sup]
*/
long
-casual(inf, sup)
- long inf, sup;
+casual(long inf, long sup)
{
double value;
@@ -701,19 +692,16 @@
}
char *
-date()
+date(void)
{
- struct timeval tv;
time_t tv_sec;
- (void)gettimeofday(&tv, (struct timezone *)0);
- tv_sec = tv.tv_sec;
+ tv_sec = time(NULL);
return (ctime(&tv_sec));
}
void
-addnetname(name)
- char *name;
+addnetname(char *name)
{
register struct nets **netlist = &nets;
@@ -726,11 +714,11 @@
(*netlist)->name = name;
}
-/* note a host as trustworthy */
+/* note a host as trustworthy
+ * perm 1=not part of the netgroup
+ */
static void
-add_good_host(name, perm)
- char *name;
- int perm; /* 1=not part of the netgroup */
+add_good_host(char *name, int perm)
{
register struct goodhost *ghp;
register struct hostent *hentp;
@@ -756,8 +744,7 @@
/* update our image of the net-group of trustworthy hosts
*/
void
-get_goodgroup(force)
- int force;
+get_goodgroup(int force)
{
# define NG_DELAY (30*60*CLK_TCK) /* 30 minutes */
static unsigned long last_update = -NG_DELAY;
@@ -825,8 +812,7 @@
/* see if a machine is trustworthy
*/
int /* 1=trust hp to change our date */
-good_host_name(name)
- char *name;
+good_host_name(char *name)
{
register struct goodhost *ghp = goodhosts;
register char c;
More information about the Midnightbsd-cvs
mailing list