summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zhm/queue.c50
-rw-r--r--zhm/timer.c26
-rw-r--r--zhm/zhm.c50
-rw-r--r--zhm/zhm_client.c10
-rw-r--r--zhm/zhm_server.c31
5 files changed, 83 insertions, 84 deletions
diff --git a/zhm/queue.c b/zhm/queue.c
index 5a072aa..27e7ca2 100644
--- a/zhm/queue.c
+++ b/zhm/queue.c
@@ -30,17 +30,18 @@ typedef struct _Queue {
static Queue *hm_queue;
static int retransmits_enabled = 0;
-static Queue *find_notice_in_queue __P((ZNotice_t *notice));
-static Code_t dump_queue __P((void));
-static void queue_timeout __P((void *arg));
+static Queue *find_notice_in_queue(ZNotice_t *notice);
+static Code_t dump_queue(void);
+static void queue_timeout(void *arg);
int rexmit_times[] = { 2, 2, 4, 4, 8, -1 };
#ifdef DEBUG
-Code_t dump_queue();
+Code_t dump_queue(void);
#endif
-void init_queue()
+void
+init_queue(void)
{
Queue *q;
@@ -56,11 +57,11 @@ void init_queue()
DPR("Queue initialized and flushed.\n");
}
-Code_t add_notice_to_queue(notice, packet, repl, len)
- ZNotice_t *notice;
- char * packet;
- struct sockaddr_in *repl;
- int len;
+Code_t
+add_notice_to_queue(ZNotice_t *notice,
+ char *packet,
+ struct sockaddr_in *repl,
+ int len)
{
Queue *entry;
@@ -89,10 +90,10 @@ Code_t add_notice_to_queue(notice, packet, repl, len)
return(ZERR_NONE);
}
-Code_t remove_notice_from_queue(notice, kind, repl)
- ZNotice_t *notice;
- ZNotice_Kind_t *kind;
- struct sockaddr_in *repl;
+Code_t
+remove_notice_from_queue(ZNotice_t *notice,
+ ZNotice_Kind_t *kind,
+ struct sockaddr_in *repl)
{
Queue *entry;
@@ -115,8 +116,8 @@ Code_t remove_notice_from_queue(notice, kind, repl)
}
/* We have a server; transmit all of our packets. */
-void retransmit_queue(sin)
- struct sockaddr_in *sin;
+void
+retransmit_queue(struct sockaddr_in *sin)
{
Queue *entry;
Code_t ret;
@@ -148,7 +149,8 @@ void retransmit_queue(sin)
}
/* We lost our server; nuke all of our timers. */
-void disable_queue_retransmits()
+void
+disable_queue_retransmits(void)
{
Queue *entry;
@@ -161,7 +163,8 @@ void disable_queue_retransmits()
}
#ifdef DEBUG
-static Code_t dump_queue()
+static Code_t
+dump_queue(void)
{
Queue *entry;
caddr_t mp;
@@ -193,7 +196,8 @@ static Code_t dump_queue()
}
#endif /* DEBUG */
-int queue_len()
+int
+queue_len(void)
{
int length = 0;
Queue *entry;
@@ -203,8 +207,8 @@ int queue_len()
return length;
}
-static Queue *find_notice_in_queue(notice)
- ZNotice_t *notice;
+static Queue *
+find_notice_in_queue(ZNotice_t *notice)
{
Queue *entry;
@@ -215,8 +219,8 @@ static Queue *find_notice_in_queue(notice)
return NULL;
}
-static void queue_timeout(arg)
- void *arg;
+static void
+queue_timeout(void *arg)
{
Queue *entry = (Queue *) arg;
Code_t ret;
diff --git a/zhm/timer.c b/zhm/timer.c
index 1fe3d39..82c02aa 100644
--- a/zhm/timer.c
+++ b/zhm/timer.c
@@ -115,13 +115,13 @@ static Timer **heap;
static int num_timers = 0;
static int heap_size = 0;
-static void timer_botch __P((void*));
-static Timer *add_timer __P((Timer *));
+static void timer_botch (void*);
+static Timer *add_timer (Timer *);
-Timer *timer_set_rel(time_rel, proc, arg)
- long time_rel;
- void (*proc) __P((void *));
- void *arg;
+Timer *
+timer_set_rel(long time_rel,
+ void (*proc)(void *),
+ void *arg)
{
Timer *new_t;
@@ -135,8 +135,7 @@ Timer *timer_set_rel(time_rel, proc, arg)
}
void
-timer_reset(tmr)
- Timer *tmr;
+timer_reset(Timer *tmr)
{
int pos, min;
@@ -177,8 +176,7 @@ timer_reset(tmr)
#define set_timeval(t,s) ((t).tv_sec=(s),(t).tv_usec=0,(t))
static Timer *
-add_timer(new)
- Timer *new;
+add_timer(Timer *new)
{
int pos;
@@ -208,7 +206,7 @@ add_timer(new)
}
void
-timer_process()
+timer_process(void)
{
Timer *t;
timer_proc func;
@@ -232,8 +230,7 @@ timer_process()
}
struct timeval *
-timer_timeout(tvbuf)
- struct timeval *tvbuf;
+timer_timeout(struct timeval *tvbuf)
{
if (num_timers > 0) {
tvbuf->tv_sec = heap[0]->abstime - time(NULL);
@@ -247,8 +244,7 @@ timer_timeout(tvbuf)
}
static void
-timer_botch(arg)
- void *arg;
+timer_botch(void *arg)
{
syslog(LOG_CRIT, "timer botch\n");
abort();
diff --git a/zhm/zhm.c b/zhm/zhm.c
index 4061c17..f6f3fc1 100644
--- a/zhm/zhm.c
+++ b/zhm/zhm.c
@@ -42,27 +42,30 @@ struct hostent *hp;
char hostname[MAXHOSTNAMELEN], loopback[4];
char PidFile[128];
-static RETSIGTYPE deactivate __P((void));
-static RETSIGTYPE terminate __P((void));
-static void choose_server __P((void));
-static void init_hm __P((void));
-static void detach __P((void));
-static void send_stats __P((ZNotice_t *, struct sockaddr_in *));
-static char *strsave __P((const char *));
+static RETSIGTYPE deactivate(int);
+static RETSIGTYPE terminate(int);
+static void choose_server(void);
+static void init_hm(void);
+static void detach(void);
+static void send_stats(ZNotice_t *, struct sockaddr_in *);
+static char *strsave(const char *);
extern int optind;
-static RETSIGTYPE deactivate()
+static RETSIGTYPE
+deactivate(int ignored)
{
deactivating = 1;
}
-static RETSIGTYPE terminate()
+static RETSIGTYPE
+terminate(int ignored)
{
terminating = 1;
}
-main(argc, argv)
-char *argv[];
+int
+main(int argc,
+ char *argv[])
{
ZNotice_t notice;
ZPacket_t packet;
@@ -246,7 +249,8 @@ char *argv[];
}
}
-static void choose_server()
+static void
+choose_server(void)
{
int i = 0;
char **clust_info, **cpp;
@@ -353,7 +357,8 @@ static void choose_server()
}
}
-static void init_hm()
+static void
+init_hm(void)
{
struct servent *sp;
Code_t ret;
@@ -454,7 +459,8 @@ static void init_hm()
#endif
}
-static void detach()
+static void
+detach(void)
{
/* detach from terminal and fork. */
register int i, x = ZGetFD();
@@ -494,9 +500,9 @@ static void detach()
static char version[BUFSIZ];
-static void send_stats(notice, sin)
- ZNotice_t *notice;
- struct sockaddr_in *sin;
+static void
+send_stats(ZNotice_t *notice,
+ struct sockaddr_in *sin)
{
ZNotice_t newnotice;
Code_t ret;
@@ -608,7 +614,8 @@ static void send_stats(notice, sin)
free(list[i]);
}
-void die_gracefully()
+void
+die_gracefully(void)
{
syslog(LOG_INFO, "Terminate signal caught...");
unlink(PidFile);
@@ -616,14 +623,13 @@ void die_gracefully()
exit(0);
}
-static char *strsave(sp)
- const char *sp;
+static char *
+strsave(const char *sp)
{
register char *ret;
- if((ret = malloc((unsigned) strlen(sp)+1)) == NULL) {
+ if((ret = strdup(sp)) == NULL) {
abort();
}
- strcpy(ret,sp);
return(ret);
}
diff --git a/zhm/zhm_client.c b/zhm/zhm_client.c
index 0da6bee..03514c6 100644
--- a/zhm/zhm_client.c
+++ b/zhm/zhm_client.c
@@ -21,10 +21,9 @@ static char rcsid_hm_client_c[] = "$Id$";
extern int no_server, nclt, deactivated, noflushflag;
extern struct sockaddr_in cli_sin, serv_sin, from;
-void transmission_tower(notice, packet, pak_len)
- ZNotice_t *notice;
- char *packet;
- int pak_len;
+void transmission_tower(ZNotice_t *notice,
+ char *packet,
+ int pak_len)
{
ZNotice_t gack;
Code_t ret;
@@ -84,8 +83,7 @@ void transmission_tower(notice, packet, pak_len)
}
Code_t
-send_outgoing(notice)
-ZNotice_t *notice;
+send_outgoing(ZNotice_t *notice)
{
Code_t retval;
char *packet;
diff --git a/zhm/zhm_server.c b/zhm/zhm_server.c
index 50fa04f..47b2d59 100644
--- a/zhm/zhm_server.c
+++ b/zhm/zhm_server.c
@@ -33,15 +33,16 @@ extern int deactivated, rebootflag;
extern int numserv;
extern char **serv_list;
extern char cur_serv[], prim_serv[];
-extern void die_gracefully();
+extern void die_gracefully(void);
-void hm_control(), send_back(), new_server();
+void hm_control(ZNotice_t *);
+void send_back(ZNotice_t *);
+void new_server(char *);
/* Argument is whether we are actually booting, or just attaching
* after a server switch */
void
-send_boot_notice(op)
-char *op;
+send_boot_notice(char *op)
{
ZNotice_t notice;
Code_t ret;
@@ -72,8 +73,7 @@ char *op;
/* Argument is whether we are detaching or really going down */
void
-send_flush_notice(op)
-char *op;
+send_flush_notice(char *op)
{
ZNotice_t notice;
Code_t ret;
@@ -102,8 +102,7 @@ char *op;
}
void
-find_next_server(sugg_serv)
-char *sugg_serv;
+find_next_server(char *sugg_serv)
{
struct hostent *hp;
int done = 0;
@@ -176,8 +175,7 @@ char *sugg_serv;
}
void
-server_manager(notice)
-ZNotice_t *notice;
+server_manager(ZNotice_t *notice)
{
if (memcmp((char *)&serv_sin.sin_addr, (char *)&from.sin_addr, 4) ||
(serv_sin.sin_port != from.sin_port)) {
@@ -208,8 +206,7 @@ ZNotice_t *notice;
}
void
-hm_control(notice)
-ZNotice_t *notice;
+hm_control(ZNotice_t *notice)
{
Code_t ret;
struct hostent *hp;
@@ -251,8 +248,7 @@ ZNotice_t *notice;
}
void
-send_back(notice)
-ZNotice_t *notice;
+send_back(ZNotice_t *notice)
{
ZNotice_Kind_t kind;
struct sockaddr_in repl;
@@ -290,8 +286,7 @@ ZNotice_t *notice;
}
void
-new_server(sugg_serv)
-char *sugg_serv;
+new_server(char *sugg_serv)
{
no_server = 1;
syslog (LOG_INFO, "Server went down, finding new server.");
@@ -306,8 +301,8 @@ char *sugg_serv;
disable_queue_retransmits();
}
-static void boot_timeout(arg)
-void *arg;
+static void
+boot_timeout(void *arg)
{
serv_timeouts++;
new_server(NULL);