#include <sys/types.h>
#include <stdlib.h>
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#else
#include <unistd.h>
#endif
#include <signal.h>
+#include <afs/afsutil.h>
#include <time.h>
#include <lock.h>
#include "ubik.h"
#include "ubik_int.h"
+/* needed by Irix. Include a header to get it, or leave it alone. */
extern struct hostent *hostutil_GetHostByName();
static short
}
static int
-CommandProc(struct cmd_syndesc *as, char *arock)
+CommandProc(struct cmd_syndesc *as, void *arock)
{
char *hostName, *portName, *times;
afs_int32 hostAddr;
- struct in_addr inhostAddr;
register afs_int32 i, j, code;
short port;
int int32p;
- afs_int32 now, diff, newtime;
+ time_t now, then, diff, newtime;
struct hostent *th;
struct rx_connection *tconn;
struct rx_securityClass *sc;
exit(0);
}
now = time(0);
+ then = udebug.now;
/* now print the main info */
- times = ctime((time_t *) & udebug.now);
+ times = ctime(&then);
times[24] = 0;
- inhostAddr.s_addr = hostAddr;
if (!oldServer) {
printf("Host's addresses are: ");
for (j = 0; udebug.interfaceAddr[j] && (j < UBIK_MAX_INTERFACE_ADDR);
printf("%s ", afs_inet_ntoa(htonl(udebug.interfaceAddr[j])));
printf("\n");
}
- printf("Host's %s time is %s\n", inet_ntoa(inhostAddr), times);
+ printf("Host's %s time is %s\n", afs_inet_ntoa(hostAddr), times);
times = ctime(&now);
times[24] = 0;
diff = now - udebug.now;
- printf("Local time is %s (time differential %d secs)\n", times, diff);
- if (abs(diff) >= MAXSKEW)
+ printf("Local time is %s (time differential %d secs)\n", times, (int)diff);
+ if (abs((int)diff) >= MAXSKEW)
printf("****clock may be bad\n");
/* UBIK skips the voting if 1 server - so we fudge it here */
if (udebug.lastYesHost == 0xffffffff) {
printf("Last yes vote not cast yet \n");
} else {
- inhostAddr.s_addr = htonl(udebug.lastYesHost);
diff = udebug.now - udebug.lastYesTime;
printf("Last yes vote for %s was %d secs ago (%ssync site); \n",
- inet_ntoa(inhostAddr), diff,
+ afs_inet_ntoa(udebug.lastYesHost), (int)diff,
((udebug.lastYesState) ? "" : "not "));
diff = udebug.now - udebug.lastYesClaim;
newtime = now - diff;
times = ctime(&newtime);
times[24] = 0;
- printf("Last vote started %d secs ago (at %s)\n", diff, times);
+ printf("Last vote started %d secs ago (at %s)\n", (int)diff, times);
}
printf("Local db version is %d.%d\n", udebug.localVersion.epoch,
times[24] = 0;
printf
("I am sync site until %d secs from now (at %s) (%d server%s)\n",
- diff, times, udebug.nServers,
+ (int)diff, times, udebug.nServers,
((udebug.nServers > 1) ? "s" : ""));
}
printf("Recovery state %x\n", udebug.recoveryState);
printf("I am a clone and never can become sync site\n");
else
printf("I am not sync site\n");
- inhostAddr.s_addr = htonl(udebug.lowestHost);
diff = udebug.now - udebug.lowestTime;
- printf("Lowest host %s was set %d secs ago\n", inet_ntoa(inhostAddr),
- diff);
+ printf("Lowest host %s was set %d secs ago\n",
+ afs_inet_ntoa(htonl(udebug.lowestHost)),
+ (int)diff);
- inhostAddr.s_addr = htonl(udebug.syncHost);
diff = udebug.now - udebug.syncTime;
- printf("Sync host %s was set %d secs ago\n", inet_ntoa(inhostAddr),
- diff);
+ printf("Sync host %s was set %d secs ago\n",
+ afs_inet_ntoa(htonl(udebug.syncHost)),
+ (int)diff);
}
printf("Sync site's db version is %d.%d\n", udebug.syncVersion.epoch,
times[24] = 0;
printf
("Last time a new db version was labelled was:\n\t %d secs ago (at %s)\n",
- diff, times);
+ (int)diff, times);
}
if (int32p || udebug.amSyncSite) {
printf("error code %d from VOTE_SDebug\n", code);
break;
}
- inhostAddr.s_addr = htonl(usdebug.addr);
/* otherwise print the structure */
printf("\nServer (%s", afs_inet_ntoa(htonl(usdebug.addr)));
for (j = 0;
newtime = now - diff;
times = ctime(&newtime);
times[24] = 0;
- printf(" last vote rcvd %d secs ago (at %s),\n", diff,
+ printf(" last vote rcvd %d secs ago (at %s),\n", (int)diff,
times);
}
times[24] = 0;
printf
(" last beacon sent %d secs ago (at %s), last vote was %s\n",
- diff, times, ((usdebug.lastVote) ? "yes" : "no"));
+ (int)diff, times, ((usdebug.lastVote) ? "yes" : "no"));
}
printf(" dbcurrent=%d, up=%d beaconSince=%d\n",
nsa.sa_flags = SA_FULLDUMP;
sigaction(SIGSEGV, &nsa, NULL);
#endif
- ts = cmd_CreateSyntax(NULL, CommandProc, 0, "probe ubik server");
+ ts = cmd_CreateSyntax(NULL, CommandProc, NULL, "probe ubik server");
cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "server machine");
cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "IP port");
cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "print all info");