summaryrefslogtreecommitdiffstats
path: root/usr.sbin/timed
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2013-02-08 16:10:16 +0000
committerobrien <obrien@FreeBSD.org>2013-02-08 16:10:16 +0000
commit3028e3f8aba938dfd0bf9fda987b8a72140b8027 (patch)
treeb2f038222ff8a70f687652441df00d2b564c8abe /usr.sbin/timed
parent952a6d5a7cd3d3f9007acfa06805262fc04a105f (diff)
parent1d08d5f677c1dfa810e381073590adbae19cc69f (diff)
downloadFreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.zip
FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.tar.gz
Sync with HEAD.
Diffstat (limited to 'usr.sbin/timed')
-rw-r--r--usr.sbin/timed/timed/acksend.c19
-rw-r--r--usr.sbin/timed/timed/byteorder.c6
-rw-r--r--usr.sbin/timed/timed/candidate.c3
-rw-r--r--usr.sbin/timed/timed/cksum.c4
-rw-r--r--usr.sbin/timed/timed/correct.c10
-rw-r--r--usr.sbin/timed/timed/master.c41
-rw-r--r--usr.sbin/timed/timed/measure.c20
-rw-r--r--usr.sbin/timed/timed/networkdelta.c2
-rw-r--r--usr.sbin/timed/timed/readmsg.c16
-rw-r--r--usr.sbin/timed/timed/slave.c11
-rw-r--r--usr.sbin/timed/timed/timed.c46
-rw-r--r--usr.sbin/timed/timedc/cmds.c24
-rw-r--r--usr.sbin/timed/timedc/timedc.c16
13 files changed, 75 insertions, 143 deletions
diff --git a/usr.sbin/timed/timed/acksend.c b/usr.sbin/timed/timed/acksend.c
index fde1404..8492f9e 100644
--- a/usr.sbin/timed/timed/acksend.c
+++ b/usr.sbin/timed/timed/acksend.c
@@ -42,10 +42,7 @@ struct tsp *answer;
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 +65,15 @@ xmit(type, seq, addr)
*
* 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;
diff --git a/usr.sbin/timed/timed/byteorder.c b/usr.sbin/timed/timed/byteorder.c
index a9fd151..abacbd6 100644
--- a/usr.sbin/timed/timed/byteorder.c
+++ b/usr.sbin/timed/timed/byteorder.c
@@ -42,8 +42,7 @@ static const char rcsid[] =
* 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 +61,7 @@ bytenetorder(ptr)
}
void
-bytehostorder(ptr)
- struct tsp *ptr;
+bytehostorder(struct tsp *ptr)
{
ptr->tsp_seq = ntohs((u_short)ptr->tsp_seq);
switch (ptr->tsp_type) {
diff --git a/usr.sbin/timed/timed/candidate.c b/usr.sbin/timed/timed/candidate.c
index 7eae18e..c92ae70 100644
--- a/usr.sbin/timed/timed/candidate.c
+++ b/usr.sbin/timed/timed/candidate.c
@@ -44,8 +44,7 @@ static const char rcsid[] =
* 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;
diff --git a/usr.sbin/timed/timed/cksum.c b/usr.sbin/timed/timed/cksum.c
index 243ea38..7fa0a5e 100644
--- a/usr.sbin/timed/timed/cksum.c
+++ b/usr.sbin/timed/timed/cksum.c
@@ -49,9 +49,7 @@ static const char rcsid[] =
* 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;
diff --git a/usr.sbin/timed/timed/correct.c b/usr.sbin/timed/timed/correct.c
index 0eab083..8a5b464 100644
--- a/usr.sbin/timed/timed/correct.c
+++ b/usr.sbin/timed/timed/correct.c
@@ -47,8 +47,7 @@ static void adjclock(struct timeval *);
* own
*/
void
-correct(avdelta)
- long avdelta;
+correct(long avdelta)
{
struct hosttbl *htp;
int corr;
@@ -112,8 +111,7 @@ correct(avdelta)
static void
-adjclock(corr)
- struct timeval *corr;
+adjclock(struct timeval *corr)
{
static int passes = 0;
static int smoother = 0;
@@ -176,9 +174,7 @@ adjclock(corr)
* 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);
diff --git a/usr.sbin/timed/timed/master.c b/usr.sbin/timed/timed/master.c
index b64259b..9a130bf 100644
--- a/usr.sbin/timed/timed/master.c
+++ b/usr.sbin/timed/timed/master.c
@@ -63,7 +63,7 @@ static void mchgdate(struct tsp *);
* takes the appropriate action.
*/
int
-master()
+master(void)
{
struct hosttbl *htp;
long pollingtime;
@@ -339,8 +339,7 @@ loop:
* change the system date on the master
*/
static void
-mchgdate(msg)
- struct tsp *msg;
+mchgdate(struct tsp *msg)
{
char tname[MAXHOSTNAMELEN];
char olddate[32];
@@ -386,8 +385,7 @@ mchgdate(msg)
* synchronize all of the slaves
*/
void
-synch(mydelta)
- long mydelta;
+synch(long mydelta)
{
struct hosttbl *htp;
int measure_status;
@@ -460,7 +458,7 @@ synch(mydelta)
* has received the command to set the network time
*/
void
-spreadtime()
+spreadtime(void)
{
struct hosttbl *htp;
struct tsp to;
@@ -499,8 +497,7 @@ spreadtime()
}
void
-prthp(delta)
- clock_t delta;
+prthp(clock_t delta)
{
static time_t next_time;
time_t this_time;
@@ -538,8 +535,7 @@ static struct hosttbl *lasthfree = &hosttbl[0];
struct hosttbl * /* answer or 0 */
-findhost(name)
- char *name;
+findhost(char *name)
{
int i, j;
struct hosttbl *htp;
@@ -565,10 +561,7 @@ findhost(name)
* 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;
@@ -654,8 +647,7 @@ addmach(name, addr, ntp)
* 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 +698,7 @@ remmach(htp)
* given network.
*/
void
-rmnetmachs(ntp)
- struct netinfo *ntp;
+rmnetmachs(struct netinfo *ntp)
{
struct hosttbl *htp;
@@ -722,8 +713,7 @@ rmnetmachs(ntp)
}
void
-masterup(net)
- struct netinfo *net;
+masterup(struct netinfo *net)
{
xmit(TSP_MASTERUP, 0, &net->dest_addr);
@@ -736,8 +726,7 @@ masterup(net)
}
void
-newslave(msg)
- struct tsp *msg;
+newslave(struct tsp *msg)
{
struct hosttbl *htp;
struct tsp *answer, to;
@@ -782,8 +771,7 @@ newslave(msg)
* 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 +802,7 @@ doquit(msg)
}
void
-traceon()
+traceon(void)
{
if (!fd) {
fd = fopen(_PATH_TIMEDLOG, "w");
@@ -832,8 +820,7 @@ traceon()
void
-traceoff(msg)
- char *msg;
+traceoff(char *msg)
{
get_goodgroup(1);
setstatus();
diff --git a/usr.sbin/timed/timed/measure.c b/usr.sbin/timed/timed/measure.c
index 81ab7c4..8fe43b5 100644
--- a/usr.sbin/timed/timed/measure.c
+++ b/usr.sbin/timed/timed/measure.c
@@ -56,14 +56,12 @@ static n_short seqno = 0;
/*
* 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;
@@ -292,9 +290,7 @@ quit:
* 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 +306,7 @@ mstotvround(res, x)
}
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 +321,7 @@ timevaladd(tv1, tv2)
}
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;
diff --git a/usr.sbin/timed/timed/networkdelta.c b/usr.sbin/timed/timed/networkdelta.c
index e9a437a..bf2a353 100644
--- a/usr.sbin/timed/timed/networkdelta.c
+++ b/usr.sbin/timed/timed/networkdelta.c
@@ -62,7 +62,7 @@ static long median(float, float *, long *, long *, unsigned int);
* bad values.
*/
long
-networkdelta()
+networkdelta(void)
{
struct hosttbl *htp;
long med;
diff --git a/usr.sbin/timed/timed/readmsg.c b/usr.sbin/timed/timed/readmsg.c
index aca2dbe..8168612 100644
--- a/usr.sbin/timed/timed/readmsg.c
+++ b/usr.sbin/timed/timed/readmsg.c
@@ -69,11 +69,7 @@ struct timeval from_when;
*/
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;
@@ -342,7 +338,7 @@ again:
* only the type ACK is to be sent by a slave
*/
void
-slaveack()
+slaveack(void)
{
switch(msgin.tsp_type) {
@@ -374,7 +370,7 @@ slaveack()
* These packets should be acknowledged.
*/
void
-ignoreack()
+ignoreack(void)
{
switch(msgin.tsp_type) {
@@ -402,7 +398,7 @@ ignoreack()
* to the messages received by a master
*/
void
-masterack()
+masterack(void)
{
struct tsp resp;
@@ -445,9 +441,7 @@ masterack()
* 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;
diff --git a/usr.sbin/timed/timed/slave.c b/usr.sbin/timed/timed/slave.c
index 26e34f7..15c0c43 100644
--- a/usr.sbin/timed/timed/slave.c
+++ b/usr.sbin/timed/timed/slave.c
@@ -55,7 +55,7 @@ static void setmaster(struct tsp *);
static void answerdelay(void);
int
-slave()
+slave(void)
{
int tries;
long electiontime, refusetime, looktime, looptime, adjtime;
@@ -610,8 +610,7 @@ loop:
* 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 +639,7 @@ setmaster(msg)
* 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;
@@ -680,7 +677,7 @@ schgdate(msg, newdate)
* contention and likely collisions.
*/
static void
-answerdelay()
+answerdelay(void)
{
struct timeval timeout;
diff --git a/usr.sbin/timed/timed/timed.c b/usr.sbin/timed/timed/timed.c
index 4b0030c..e178912 100644
--- a/usr.sbin/timed/timed/timed.c
+++ b/usr.sbin/timed/timed/timed.c
@@ -110,9 +110,7 @@ static void usage(void);
* overhauled at Silicon Graphics
*/
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int on;
int ret;
@@ -434,7 +432,7 @@ main(argc, argv)
}
static void
-usage()
+usage(void)
{
#ifdef HAVENIS
fprintf(stderr,
@@ -450,10 +448,7 @@ usage()
* 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];
@@ -478,8 +473,7 @@ suppress(addr, name,net)
}
void
-lookformaster(ntp)
- struct netinfo *ntp;
+lookformaster(struct netinfo *ntp)
{
struct tsp resp, conflict, *answer;
struct timeval ntime;
@@ -578,7 +572,7 @@ lookformaster(ntp)
* networks;
*/
void
-setstatus()
+setstatus(void)
{
struct netinfo *ntp;
@@ -631,8 +625,7 @@ setstatus()
}
void
-makeslave(net)
- struct netinfo *net;
+makeslave(struct netinfo *net)
{
register struct netinfo *ntp;
@@ -647,7 +640,7 @@ makeslave(net)
* Try to become master over ignored nets..
*/
static void
-checkignorednets()
+checkignorednets(void)
{
register struct netinfo *ntp;
@@ -669,8 +662,7 @@ checkignorednets()
* 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 */
@@ -690,8 +682,7 @@ pickslavenet(ntp)
* returns a random number in the range [inf, sup]
*/
long
-casual(inf, sup)
- long inf, sup;
+casual(long inf, long sup)
{
double value;
@@ -700,7 +691,7 @@ casual(inf, sup)
}
char *
-date()
+date(void)
{
time_t tv_sec;
@@ -709,8 +700,7 @@ date()
}
void
-addnetname(name)
- char *name;
+addnetname(char *name)
{
register struct nets **netlist = &nets;
@@ -723,11 +713,11 @@ addnetname(name)
(*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;
@@ -753,8 +743,7 @@ add_good_host(name, perm)
/* 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;
@@ -822,8 +811,7 @@ get_goodgroup(force)
/* 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;
diff --git a/usr.sbin/timed/timedc/cmds.c b/usr.sbin/timed/timedc/cmds.c
index 84740f6..e39bf03 100644
--- a/usr.sbin/timed/timedc/cmds.c
+++ b/usr.sbin/timed/timedc/cmds.c
@@ -32,7 +32,6 @@
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
#endif /* not lint */
#endif
-
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -78,8 +77,7 @@ void bytehostorder(struct tsp *);
/* compute the difference between our date and another machine
*/
static int /* difference in days from our time */
-daydiff(hostname)
- char *hostname;
+daydiff(char *hostname)
{
int i;
int trials;
@@ -164,9 +162,7 @@ daydiff(hostname)
* measurement.
*/
void
-clockdiff(argc, argv)
- int argc;
- char *argv[];
+clockdiff(int argc, char *argv[])
{
int measure_status;
extern int measure(u_long, u_long, char *, struct sockaddr_in*, int);
@@ -263,9 +259,7 @@ clockdiff(argc, argv)
* finds location of master timedaemon
*/
void
-msite(argc, argv)
- int argc;
- char *argv[];
+msite(int argc, char *argv[])
{
ssize_t cc;
fd_set ready;
@@ -360,7 +354,7 @@ msite(argc, argv)
* quits timedc
*/
void
-quit()
+quit(void)
{
exit(0);
}
@@ -372,9 +366,7 @@ quit()
* reliability of communication channel.
*/
void
-testing(argc, argv)
- int argc;
- char *argv[];
+testing(int argc, char *argv[])
{
struct servent *srvp;
struct sockaddr_in sin;
@@ -422,9 +414,7 @@ testing(argc, argv)
* Enables or disables tracing on local timedaemon
*/
void
-tracing(argc, argv)
- int argc;
- char *argv[];
+tracing(int argc, char *argv[])
{
int onflag;
int length;
@@ -513,7 +503,7 @@ tracing(argc, argv)
}
int
-priv_resources()
+priv_resources(void)
{
int port;
struct sockaddr_in sin;
diff --git a/usr.sbin/timed/timedc/timedc.c b/usr.sbin/timed/timedc/timedc.c
index 7047f57..f81da89 100644
--- a/usr.sbin/timed/timedc/timedc.c
+++ b/usr.sbin/timed/timedc/timedc.c
@@ -62,9 +62,7 @@ jmp_buf toplevel;
static struct cmd *getcmd(char *);
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
register struct cmd *c;
@@ -131,8 +129,7 @@ main(argc, argv)
}
void
-intr(signo)
- int signo;
+intr(int signo __unused)
{
if (!fromatty)
exit(0);
@@ -141,8 +138,7 @@ intr(signo)
static struct cmd *
-getcmd(name)
- char *name;
+getcmd(char *name)
{
register char *p, *q;
register struct cmd *c, *found;
@@ -175,7 +171,7 @@ getcmd(name)
* Slice a string up into argc/argv.
*/
void
-makeargv()
+makeargv(void)
{
register char *cp;
register char **argp = margv;
@@ -203,9 +199,7 @@ makeargv()
* Help command.
*/
void
-help(argc, argv)
- int argc;
- char *argv[];
+help(int argc, char *argv[])
{
register struct cmd *c;
OpenPOWER on IntegriCloud