Change old-style function definition
This commit is contained in:
parent
cda3447bb0
commit
acd8b77456
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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 @@ master()
|
||||
* 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();
|
||||
|
@ -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 @@ measure(maxmsec, wmsec, hname, addr, print)
|
||||
* 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;
|
||||
|
@ -62,7 +62,7 @@ static long median(float, float *, long *, long *, unsigned int);
|
||||
* bad values.
|
||||
*/
|
||||
long
|
||||
networkdelta()
|
||||
networkdelta(void)
|
||||
{
|
||||
struct hosttbl *htp;
|
||||
long med;
|
||||
|
@ -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 @@ readmsg(type, machfrom, intvl, netfrom)
|
||||
* 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;
|
||||
|
@ -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 @@ slave()
|
||||
* 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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user