Commit 2d522296 authored by Leigh Stoller's avatar Leigh Stoller

Add versioning support. This has been a minor problem, and is going to

be a worse problem with remote nodes, where we will not be able to
keep everyone up to date like we can in the local testbed case. I ran
into this yesterday with the key distribution stuff for RON nodes,
which require incompatable changes to the accounts info that is
returned. So, tmcc now takes a [-v version] argument, which is passed
through to tmcd in the request field. tmcd passes that version number
(assumed to be an int) down, and the routines should look at that. We
will need to make some structural changes in tmcd as we get more
version skew, but for now this is fine. Anyway, tmcd/tmcc have a
compiled in DEFAULT_VERSION (see decls.h). If no version is supplied,
assume DEFAULT_VERSION (2), which covers all of the old images and yet
to be updated current images. As the new tmcc makes it out, versions
will be sent through. VERY IMPORTANT: The current version is placed in
libsetup.pm. When you make incompatible changes, bump the version
number is decls.h and libsetup.pm, recompile and install a new tmcc
and the new libsetup.pm on the clients (and of course, tmcd on the
server).

Fixes to termination; Add signal handlers for HUP,INT,TERM, and make
sure all the children get killed off before exiting. We still have
some problems though; I think the children should wait until the
current request is completed before exiting. I'll give that some more
thought though since it easy to mess that stuff up (leave zombies).

Add build_info[] to startup message to syslog. Good for debugging.
Some minor cleanup and restructuring. Mike is gonna hate it.
parent 89209d50
......@@ -4,3 +4,20 @@
#define TBSERVER_PORT 7777
#define MYBUFSIZE 1024
/*
* As the tmcd changes, incompatable changes with older version of
* the software cause problems. Starting with version 3, the client
* will tell tmcd what version they are. If no version is included,
* assume its DEFAULT_VERSION.
*
* Be sure to update the versions as the TMCD changes. Both the
* tmcc and tmcd have CURRENT_VERSION compiled in, so be sure to
* install new versions of each binary when the current version
* changes. libsetup.pm module also encodes a current version, so be
* sure to change it there too!
*
* Note, this is assumed to be an integer. No need for 3.23.479 ...
*/
#define DEFAULT_VERSION 2
#define CURRENT_VERSION 3
......@@ -24,14 +24,14 @@
void sigcatcher(int foo);
char *getbossnode(void);
#ifdef UDP
void doudp(int argc, char **argv, struct in_addr, int port);
void doudp(int, char **, int, struct in_addr, int);
#endif
char *usagestr =
"usage: tmcc [-u] [-p #] [-s server] <command>\n"
"usage: tmcc [-u] [-v versnum] [-p #] [-s server] <command>\n"
" -s server Specify a tmcd server to connect to\n"
" -p portnum Specify a port number to connect to\n"
" -v versnum Specify a version number for tmcd\n"
" -u Use UDP instead of TCP\n"
"\n";
......@@ -48,20 +48,18 @@ main(int argc, char **argv)
{
int sock, data, n, cc, ch, portnum;
struct sockaddr_in name;
#if 0
struct timeval tv;
#endif
struct hostent *he;
struct in_addr serverip;
char buf[MYBUFSIZE], *bp, *response = "";
char *bossnode = NULL;
int version = CURRENT_VERSION;
#ifdef UDP
int useudp = 0;
#endif
portnum = TBSERVER_PORT;
while ((ch = getopt(argc, argv, "s:p:u")) != -1)
while ((ch = getopt(argc, argv, "v:s:p:u")) != -1)
switch(ch) {
case 'p':
portnum = atoi(optarg);
......@@ -69,6 +67,9 @@ main(int argc, char **argv)
case 's':
bossnode = optarg;
break;
case 'v':
version = atoi(optarg);
break;
#ifdef UDP
case 'u':
useudp = 1;
......@@ -94,6 +95,9 @@ main(int argc, char **argv)
exit(1);
}
if (! version)
/*
* Handle built-in "bossinfo" command
*/
......@@ -104,7 +108,7 @@ main(int argc, char **argv)
#ifdef UDP
if (useudp) {
doudp(argc, argv, serverip, portnum);
doudp(argc, argv, version, serverip, portnum);
/*
* Never returns.
*/
......@@ -148,37 +152,20 @@ main(int argc, char **argv)
close(sock);
exit(1);
}
#if 0
#ifndef linux
tv.tv_sec = 30;
tv.tv_usec = 0;
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
perror("setsockopt SO_RCVTIMEO");
close(sock);
exit(1);
}
#endif
#endif
/* Start with version number */
sprintf(buf, "VERSION=%d ", version);
/*
* Since we've gone through a getopt() pass, argv[0] is now the
* first argument
*/
switch(argc) {
case 1:
n = snprintf(buf, sizeof(buf) - 1, "%s", argv[0]);
break;
case 2:
n = snprintf(buf, sizeof(buf) - 1, "%s %s", argv[0], argv[1]);
break;
case 3:
n = snprintf(buf, sizeof(buf) - 1, "%s %s %s",
argv[0], argv[1], argv[2]);
break;
default:
fprintf(stderr, "Too many command arguments!\n");
exit(1);
n = strlen(buf);
while (argc && n < sizeof(buf)) {
n += snprintf(&buf[n], sizeof(buf) - n, "%s ", argv[0]);
argc--;
argv++;
}
if (n >= sizeof(buf)) {
fprintf(stderr, "Command too large!\n");
exit(1);
......@@ -253,7 +240,7 @@ getbossnode(void)
* Not very robust, send a single request, read a single reply.
*/
void
doudp(int argc, char **argv, struct in_addr serverip, int portnum)
doudp(int argc, char **argv, int vers, struct in_addr serverip, int portnum)
{
int sock, length, n, cc;
struct sockaddr_in name, client;
......@@ -271,26 +258,18 @@ doudp(int argc, char **argv, struct in_addr serverip, int portnum)
name.sin_addr = serverip;
name.sin_port = htons(portnum);
sprintf(buf, "VERSION=%d ", vers);
/*
* Since we've gone through a getopt() pass, argv[0] is now the
* first argument
*/
switch(argc) {
case 1:
n = snprintf(buf, sizeof(buf) - 1, "%s", argv[0]);
break;
case 2:
n = snprintf(buf, sizeof(buf) - 1, "%s %s", argv[0], argv[1]);
break;
case 3:
n = snprintf(buf, sizeof(buf) - 1, "%s %s %s",
argv[0], argv[1], argv[2]);
break;
default:
fprintf(stderr, "Too many command arguments!\n");
exit(1);
n = strlen(buf);
while (argc && n < sizeof(buf)) {
n += snprintf(&buf[n], sizeof(buf) - n, "%s ", argv[0]);
argc--;
argv++;
}
if (n >= sizeof(buf)) {
fprintf(stderr, "Command too large!\n");
exit(1);
......
......@@ -33,7 +33,6 @@
#define RELOADEID "reloading"
#define TESTMODE
#define VERSION 3
#define NETMASK "255.255.255.0"
/* Defined in configure and passed in via the makefile */
......@@ -62,6 +61,7 @@ int mydb_update(char *query, ...);
static int udpchild;
static int numchildren;
static int maxchildren = MINCHILDREN;
static int killme;
#ifdef EVENTSYS
int myevent_send(address_tuple_t address);
......@@ -71,41 +71,45 @@ static event_handle_t event_handle = NULL;
/*
* Commands we support.
*/
static int doreboot(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int dostatus(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int doifconfig(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int doaccounts(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int dodelay(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int dooldhosts(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int donewhosts(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int dorpms(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int dodeltas(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int dotarballs(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int dostartcmd(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static int dostartstat(int sock, struct in_addr ipaddr, char *rdata,int tcp);
static int doready(int sock, struct in_addr ipaddr, char *rdata,int tcp);
static int doreadycount(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static int dolog(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static int domounts(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static int doloadinfo(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static int doreset(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static int dorouting(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static int dotrafgens(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static int donseconfigs(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static int dostate(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static int docreator(int sock, struct in_addr ipaddr,char *rdata,int tcp);
#define COMMAND_PROTOTYPE(x) \
static int \
x(int sock, struct in_addr ipaddr, char *rdata, int tcp, int vers)
COMMAND_PROTOTYPE(doreboot);
COMMAND_PROTOTYPE(dostatus);
COMMAND_PROTOTYPE(doifconfig);
COMMAND_PROTOTYPE(doaccounts);
COMMAND_PROTOTYPE(dodelay);
COMMAND_PROTOTYPE(dohosts);
COMMAND_PROTOTYPE(dohostsV2);
COMMAND_PROTOTYPE(dorpms);
COMMAND_PROTOTYPE(dodeltas);
COMMAND_PROTOTYPE(dotarballs);
COMMAND_PROTOTYPE(dostartcmd);
COMMAND_PROTOTYPE(dostartstat);
COMMAND_PROTOTYPE(doready);
COMMAND_PROTOTYPE(doreadycount);
COMMAND_PROTOTYPE(dolog);
COMMAND_PROTOTYPE(domounts);
COMMAND_PROTOTYPE(doloadinfo);
COMMAND_PROTOTYPE(doreset);
COMMAND_PROTOTYPE(dorouting);
COMMAND_PROTOTYPE(dotrafgens);
COMMAND_PROTOTYPE(donseconfigs);
COMMAND_PROTOTYPE(dostate);
COMMAND_PROTOTYPE(docreator);
struct command {
char *cmdname;
int (*func)(int sock, struct in_addr ipaddr, char *rdata, int tcp);
int (*func)(int, struct in_addr, char *, int, int);
} command_array[] = {
{ "reboot", doreboot },
{ "status", dostatus },
{ "ifconfig", doifconfig },
{ "accounts", doaccounts },
{ "delay", dodelay },
{ "hostnamesV2",donewhosts },
{ "hostnames", dooldhosts },
{ "hostnamesV2",dohostsV2 }, /* This will go away */
{ "hostnames", dohosts },
{ "rpms", dorpms },
{ "deltas", dodeltas },
{ "tarballs", dotarballs },
......@@ -150,12 +154,21 @@ usage()
exit(1);
}
static void
cleanup()
{
signal(SIGHUP, SIG_IGN);
killpg(0, SIGHUP);
killme = 1;
}
int
main(int argc, char **argv)
{
int tcpsock, udpsock, ch;
int length, i, status, pid;
struct sockaddr_in name;
extern char build_info[];
while ((ch = getopt(argc, argv, "dp:c:")) != -1)
switch(ch) {
......@@ -182,7 +195,8 @@ main(int argc, char **argv)
usage();
openlog("tmcd", LOG_PID, LOG_USER);
syslog(LOG_NOTICE, "daemon starting (version %d)", VERSION);
syslog(LOG_NOTICE, "daemon starting (version %d)", CURRENT_VERSION);
syslog(LOG_NOTICE, "%s", build_info);
if (! debug)
(void)daemon(0, 0);
......@@ -256,12 +270,16 @@ main(int argc, char **argv)
}
syslog(LOG_NOTICE, "listening on UDP port %d", ntohs(name.sin_port));
signal(SIGTERM, cleanup);
signal(SIGINT, cleanup);
signal(SIGHUP, cleanup);
/*
* Now fork a set of children to handle requests. We keep the
* pool at a set level. No need to get too fancy at this point.
*/
while (1) {
while (numchildren < maxchildren) {
while (!killme && numchildren < maxchildren) {
int doudp = (udpchild ? 0 : 1);
if ((pid = fork()) < 0) {
syslog(LOG_ERR, "forking server: %m");
......@@ -274,6 +292,10 @@ main(int argc, char **argv)
continue;
}
/* Child does useful work! Never Returns! */
signal(SIGTERM, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGHUP, SIG_DFL);
if (doudp)
udpserver(udpsock);
else
......@@ -294,12 +316,13 @@ main(int argc, char **argv)
numchildren--;
if (pid == udpchild)
udpchild = 0;
if (killme && !numchildren)
break;
}
done:
close(tcpsock);
close(udpsock);
syslog(LOG_NOTICE, "daemon terminating");
kill(0, SIGTERM);
exit(0);
}
......@@ -381,37 +404,45 @@ handle_request(int sock, struct sockaddr_in *client, char *rdata, int istcp)
{
struct sockaddr_in redirect_client;
int redirect = 0;
char *bp, *cp;
char buf[BUFSIZ], *bp;
int i, cc, err = 0;
int version = DEFAULT_VERSION;
cc = strlen(rdata);
bp = rdata;
while (isspace(*bp))
bp++;
/*
* Look for VERSION.
*/
if (sscanf(bp, "VERSION=%d", &i)) {
version = i;
while (! isspace(*bp))
bp++;
while (isspace(*bp))
bp++;
}
/*
* Look for REDIRECT, which is a proxy request for a
* client other than the one making the request. Good
* for testing. Might become a general tmcd redirect at
* some point, so that we can test new tmcds.
*/
if (strncmp("REDIRECT=", bp, strlen("REDIRECT=")) == 0) {
char *tp;
bp += strlen("REDIRECT=");
tp = bp;
while (! isspace(*tp))
tp++;
*tp++ = '\0';
if (sscanf(bp, "REDIRECT=%30s", buf)) {
redirect_client = *client;
redirect = 1;
inet_aton(bp, &client->sin_addr);
bp = tp;
}
if ((cp = (char *) malloc(cc + 1)) == NULL) {
syslog(LOG_ERR, "Out of memory");
return 1;
}
strcpy(cp, bp);
inet_aton(buf, &client->sin_addr);
while (! isspace(*bp))
bp++;
while (isspace(*bp))
bp++;
}
#ifndef TESTMODE
/*
* IN TESTMODE, we allow redirect.
......@@ -447,7 +478,7 @@ handle_request(int sock, struct sockaddr_in *client, char *rdata, int istcp)
* Figure out what command was given.
*/
for (i = 0; i < numcommands; i++)
if (strncmp(cp, command_array[i].cmdname,
if (strncmp(bp, command_array[i].cmdname,
strlen(command_array[i].cmdname)) == 0)
break;
......@@ -456,43 +487,43 @@ handle_request(int sock, struct sockaddr_in *client, char *rdata, int istcp)
*/
if (i == numcommands) {
syslog(LOG_INFO, "%s INVALID REQUEST: %.8s...",
inet_ntoa(client->sin_addr), cp);
inet_ntoa(client->sin_addr), bp);
goto skipit;
}
else {
bp = cp + strlen(command_array[i].cmdname);
bp += strlen(command_array[i].cmdname);
/*
* XXX hack, don't log "log" contents,
* both for privacy and to keep our syslog smaller.
*/
if (command_array[i].func == dolog)
syslog(LOG_INFO, "%s REQUEST: log %d chars",
syslog(LOG_INFO, "%s log %d chars",
inet_ntoa(client->sin_addr), strlen(bp));
else
syslog(LOG_INFO, "%s REQUEST: %s",
syslog(LOG_INFO, "%s vers:%d %s",
inet_ntoa(client->sin_addr),
command_array[i].cmdname);
version, command_array[i].cmdname);
err = command_array[i].func(sock, client->sin_addr, bp, istcp);
err = command_array[i].func(sock, client->sin_addr,
bp, istcp, version);
syslog(LOG_INFO, "%s REQUEST: %s: returned %d",
syslog(LOG_INFO, "%s %s: returned %d",
inet_ntoa(client->sin_addr),
command_array[i].cmdname, err);
}
skipit:
free(cp);
if (!istcp)
client_writeback_done(sock, &client);
if (!istcp)
client_writeback_done(sock,
redirect ? &redirect_client : client);
return 0;
}
/*
* Accept notification of reboot.
*/
static int
doreboot(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(doreboot)
{
MYSQL_RES *res;
char nodeid[32];
......@@ -583,8 +614,7 @@ doreboot(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return status of node. Is it allocated to an experiment, or free.
*/
static int
dostatus(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dostatus)
{
char nodeid[32];
char pid[64];
......@@ -624,8 +654,7 @@ dostatus(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return ifconfig information to client.
*/
static int
doifconfig(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(doifconfig)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -745,8 +774,7 @@ doifconfig(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return account stuff.
*/
static int
doaccounts(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(doaccounts)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -826,13 +854,14 @@ doaccounts(int sock, struct in_addr ipaddr, char *rdata, int tcp)
#ifdef NOSHAREDEXPTS
res = mydb_query("select distinct "
" u.uid,u.usr_pswd,u.unix_uid,u.usr_name, "
" p.trust,p.pid,p.gid,g.unix_gid,u.admin "
" p.trust,p.pid,p.gid,g.unix_gid,u.admin, "
" u.emulab_pubkey,u.home_pubkey "
"from users as u "
"left join group_membership as p on p.uid=u.uid "
"left join groups as g on p.pid=g.pid "
"where p.pid='%s' and p.gid='%s' "
" and u.status='active' order by u.uid",
9, pid, eid, pid, gid);
11, pid, eid, pid, gid);
#else
/*
* See if a shared experiment. Used below.
......@@ -866,25 +895,27 @@ doaccounts(int sock, struct in_addr ipaddr, char *rdata, int tcp)
if (strcmp(pid, gid)) {
res = mydb_query("select distinct "
" u.uid,u.usr_pswd,u.unix_uid,u.usr_name, "
" p.trust,g.pid,g.gid,g.unix_gid,u.admin "
" p.trust,g.pid,g.gid,g.unix_gid,u.admin, "
" u.emulab_pubkey,u.home_pubkey "
"from users as u "
"left join group_membership as p on p.uid=u.uid "
"left join groups as g on p.pid=g.pid "
"where ((p.pid='%s' and p.gid='%s')) "
" and u.status='active' order by u.uid",
9, pid, gid);
11, pid, gid);
}
else {
res = mydb_query("select distinct "
" u.uid,u.usr_pswd,u.unix_uid,u.usr_name, "
" p.trust,g.pid,g.gid,g.unix_gid,u.admin "
" p.trust,g.pid,g.gid,g.unix_gid,u.admin, "
" u.emulab_pubkey,u.home_pubkey "
"from users as u "
"left join group_membership as p on p.uid=u.uid "
"left join groups as g on "
" p.pid=g.pid and p.gid=g.gid "
"where ((p.pid='%s')) "
" and u.status='active' order by u.uid",
9, pid);
11, pid);
}
#endif
if (!res) {
......@@ -988,8 +1019,11 @@ doaccounts(int sock, struct in_addr ipaddr, char *rdata, int tcp)
USERDIR, row[0], glist);
client_writeback(sock, buf, strlen(buf), tcp);
syslog(LOG_INFO, "ACCOUNTS: %s", buf);
syslog(LOG_INFO, "ACCOUNTS: "
"ADDUSER LOGIN=%s "
"UID=%s GID=%d ROOT=%d GLIST=%s",
row[0], row[2], gidint, root, glist);
row = nextrow;
}
mysql_free_result(res);
......@@ -1000,8 +1034,7 @@ doaccounts(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return account stuff.
*/
static int
dodelay(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dodelay)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -1109,25 +1142,15 @@ dodelay(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return host table information.
*/
static int dohosts(int sock, struct in_addr ipaddr, char *rdata, int tcp, int);
static int
dooldhosts(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dohostsV2)
{
return(dohosts(sock, ipaddr, rdata, tcp, 1));
}
static int
donewhosts(int sock, struct in_addr ipaddr, char *rdata, int tcp)
{
return(dohosts(sock, ipaddr, rdata, tcp, 2));
/*
* This will go away. Ignore version and assume latest.
*/
return(dohosts(sock, ipaddr, rdata, tcp, CURRENT_VERSION));
}
/*
* Return host table information.
*/
static int
dohosts(int sock, struct in_addr ipaddr, char *rdata, int tcp, int vers)
COMMAND_PROTOTYPE(dohosts)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -1320,7 +1343,8 @@ dohosts(int sock, struct in_addr ipaddr, char *rdata, int tcp, int vers)
*/
host = hosts;
while (host) {
if (vers == 1) {
/* Old format */
if (vers == 2) {
sprintf(buf,
"NAME=%s LINK=%i IP=%s ALIAS=%s\n",
host->vname, host->virtiface,
......@@ -1359,8 +1383,7 @@ dohosts(int sock, struct in_addr ipaddr, char *rdata, int tcp, int vers)
/*
* Return RPM stuff.
*/
static int
dorpms(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dorpms)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -1426,8 +1449,7 @@ dorpms(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return Tarball stuff.
*/
static int
dotarballs(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dotarballs)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -1496,8 +1518,7 @@ dotarballs(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return Deltas stuff.
*/
static int
dodeltas(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dodeltas)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -1564,8 +1585,7 @@ dodeltas(int sock, struct in_addr ipaddr, char *rdata, int tcp)
* Return node run command. We return the command to run, plus the UID
* of the experiment creator to run it as!
*/
static int
dostartcmd(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dostartcmd)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -1648,8 +1668,7 @@ dostartcmd(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Accept notification of start command exit status.
*/
static int
dostartstat(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dostartstat)
{
char nodeid[32];
char pid[64];
......@@ -1702,8 +1721,7 @@ dostartstat(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Accept notification of ready for action
*/
static int
doready(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(doready)
{
char nodeid[32];
char pid[64];
......@@ -1745,8 +1763,7 @@ doready(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return ready bits count (NofM)
*/
static int
doreadycount(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(doreadycount)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -1813,8 +1830,7 @@ static char logfmt[] = "/proj/%s/logs/%s.log";
/*
* Log some text to a file in the /proj/<pid>/exp/<eid> directory.
*/
static int
dolog(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dolog)
{
char nodeid[32];
char pid[64];
......@@ -1863,8 +1879,7 @@ dolog(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return mount stuff.
*/
static int
domounts(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(domounts)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -1980,8 +1995,7 @@ domounts(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return routing stuff.
*/
static int
dorouting(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dorouting)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -2045,8 +2059,7 @@ dorouting(int sock, struct in_addr ipaddr, char *rdata, int tcp)
* Return address from which to load an image, along with the partition that
* it should be written to
*/
static int
doloadinfo(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(doloadinfo)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -2101,8 +2114,7 @@ doloadinfo(int sock, struct in_addr ipaddr, char *rdata, int tcp)
* or next_boot_osid is set, clear both along with next_boot_cmd_line.
* If neither is set, do nothing. Produces no output to the client.
*/
static int
doreset(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(doreset)
{
MYSQL_RES *res;
char nodeid[32];
......@@ -2187,8 +2199,7 @@ doreset(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return trafgens info
*/
static int
dotrafgens(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dotrafgens)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -2252,8 +2263,7 @@ dotrafgens(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return nseconfigs info
*/
static int
donseconfigs(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(donseconfigs)
{
MYSQL_RES *res;
MYSQL_ROW row;
......@@ -2314,12 +2324,10 @@ donseconfigs(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Report that the node has entered a new state
*/
static int
dostate(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(dostate)
{
char nodeid[32];
char *newstate;
time_t now;
#ifdef EVENTSYS
address_tuple_t tuple;
#endif
......@@ -2368,8 +2376,7 @@ dostate(int sock, struct in_addr ipaddr, char *rdata, int tcp)
/*
* Return creator of experiment. Total hack. Must kill this.
*/
static int
docreator(int sock, struct in_addr ipaddr, char *rdata, int tcp)
COMMAND_PROTOTYPE(docreator)
{
MYSQL_RES *res;