From: Simon Wilkinson Date: Wed, 22 Sep 2010 16:33:26 +0000 (+0100) Subject: rxkad: Make the test suite build again X-Git-Tag: openafs-devel-1_7_1~1527 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=d17adc30027d795068504dc736dac849ed42a884 rxkad: Make the test suite build again Make the rxkad stress test suite build again. Change-Id: I8ff7aecb768f0f46129f612e8bcbef20d59c8886 Reviewed-on: http://gerrit.openafs.org/2832 Tested-by: BuildBot Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/rxkad/test/Makefile.in b/src/rxkad/test/Makefile.in index adee7c7..7f6ed11 100644 --- a/src/rxkad/test/Makefile.in +++ b/src/rxkad/test/Makefile.in @@ -28,13 +28,11 @@ LIBS=${TOP_LIBDIR}/libauth.a \ ${TOP_LIBDIR}/libcom_err.a \ ${TOP_LIBDIR}/util.a -LIBRPC = ../../librpc/libafsrpc.so -THLIBS= ${LDIR}/afs/libcmd.a ${LDIR}/afs/libcom_err.a \ - ${ULIBS} ${XLIBS} ${LIBRPC} -lpthread +THLIBS= ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libcom_err.a \ + ${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a \ + ${MT_LIBS} ${ULIBS} ${XLIBS} ${LIBRPC} -lpthread -THFLAGS = -mt -DAFS_PTHREAD_ENV - -THRULE = ${CC} ${CFLAGS} ${THFLAGS} -c $? +THRULE = ${MT_CC} ${CFLAGS} ${MT_CFLAGS} noversion all test system: stress @@ -47,45 +45,56 @@ stress.cs.o: stress.cs.c stress.xdr.o: stress.xdr.c stress.h th_stress.ss.o: stress.ss.c - ${THRULE} -o th_stress.ss.o + ${THRULE} -c stress.ss.c -o th_stress.ss.o th_stress.cs.o: stress.cs.c - ${THRULE} -o th_stress.cs.o + ${THRULE} -c stress.cs.c -o th_stress.cs.o th_stress.xdr.o: stress.xdr.c stress.h - ${THRULE} -o th_stress.xdr.o + ${THRULE} -c stress.xdr.c -o th_stress.xdr.o + +stress.ss.c: stress.rg + ${RXGEN} -A -x -S -o stress.ss.c $(srcdir)/stress.rg + +stress.cs.c: stress.rg + ${RXGEN} -A -x -C -o stress.cs.c $(srcdir)/stress.rg + +stress.xdr.c: stress.rg + ${RXGEN} -A -x -c -o stress.xdr.c $(srcdir)/stress.rg -stress.ss.c stress.cs.c stress.xdr.c stress.h: stress.rg - ${RXGEN} stress.rg +stress.h: stress.rg + ${RXGEN} -A -x -h -o stress.h $(srcdir)/stress.rg stress_errs.o: stress_errs.c th_stress_errs.o: stress_errs.c - ${THRULE} -o th_stress_errs.o + ${THRULE} -c $(srcdir)/stress_errs.c -o th_stress_errs.o stress_errs.c stress_errs.h: stress_errs.et $(RM) -f stress_errs.h stress_errs.c; ${COMPILE_ET} -p ${srcdir} stress_errs -h stress_errs -stress.o stress_c.o stress_s.o: ${HEADERS} +stress.o: ${HEADERS} +stress_c.o: ${HEADERS} +stress_s.o: ${HEADERS} th_stress.o: stress.c ${HEADERS} - ${THRULE} -o th_stress.o + ${THRULE} -c $(srcdir)/stress.c -o th_stress.o th_stress_c.o: stress_c.c ${HEADERS} - ${THRULE} -o th_stress_c.o + ${THRULE} -c $(srcdir)/stress_c.c -o th_stress_c.o th_stress_s.o: stress_s.c ${HEADERS} - ${THRULE} -o th_stress_s.o + ${THRULE} -c $(srcdir)/stress_s.c -o th_stress_s.o stress: stress.o stress.xdr.o stress_c.o stress_s.o stress.cs.o \ stress.ss.o stress_errs.o $(CC) $(CFLAGS) -o stress stress.o stress.xdr.o stress_c.o \ - stress_s.o stress.cs.o stress.ss.o stress_errs.o ${LIBS} + stress_s.o stress.cs.o stress.ss.o stress_errs.o ${LIBS} ${XLIBS} th_stress: th_stress.o th_stress.xdr.o th_stress_c.o th_stress_s.o \ th_stress.cs.o th_stress.ss.o stress_errs.o \ ${LIBRPC} ${CC} ${CFLAGS} ${THFLAGS} -o th_stress th_stress.o th_stress.xdr.o \ th_stress_c.o th_stress_s.o th_stress.cs.o th_stress.ss.o \ - stress_errs.o ${THLIBS} + stress_errs.o ${THLIBS} ${XLIBS} diff --git a/src/rxkad/test/stress.c b/src/rxkad/test/stress.c index 1536d05..1c7270e 100644 --- a/src/rxkad/test/stress.c +++ b/src/rxkad/test/stress.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include @@ -42,8 +44,7 @@ int maxSkew = 5; static char *whoami; static int -StringToAuth(authname) - IN char *authname; +StringToAuth(const char *authname) { int nonoauth = 0; if (strcmp(authname, "rxkad") == 0) @@ -268,16 +269,14 @@ CommandProc(struct cmd_syndesc *as, void *arock) } /* donate this LWP to server-side */ - rx_ServerProc(); + rx_ServerProc(NULL); } return 0; } -void -main(argc, argv) - IN int argc; - IN char *argv[]; +int +main(int argc, char **argv) { long code; #ifndef AFS_PTHREAD_ENV diff --git a/src/rxkad/test/stress_c.c b/src/rxkad/test/stress_c.c index d0dab8e..fb026f3 100644 --- a/src/rxkad/test/stress_c.c +++ b/src/rxkad/test/stress_c.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "stress.h" #include "stress_internal.h" #ifdef AFS_PTHREAD_ENV @@ -38,8 +39,7 @@ extern int maxSkew; static char *whoami; static long -GetServer(aname) - IN char *aname; +GetServer(const char *aname) { struct hostent *th; long addr; @@ -54,11 +54,8 @@ GetServer(aname) } static long -GetToken(versionP, session, ticketLenP, ticket, cell) - OUT long *versionP; - OUT struct ktc_encryptionKey *session; - OUT int *ticketLenP; - OUT char *ticket; +GetToken(long *versionP, struct ktc_encryptionKey *session, + int *ticketLenP, char *ticket, char *cell) { struct ktc_principal sname; struct ktc_token ttoken; @@ -79,17 +76,14 @@ GetToken(versionP, session, ticketLenP, ticket, cell) } static long -GetTicket(versionP, session, ticketLenP, ticket, cell) - OUT long *versionP; - OUT struct ktc_encryptionKey *session; - OUT int *ticketLenP; - OUT char *ticket; +GetTicket(long *versionP, struct ktc_encryptionKey *session, + int *ticketLenP, char *ticket, char *cell) { long code; /* create random session key, using key for seed to good random */ - des_init_random_number_generator(&serviceKey); - code = des_random_key(session); + des_init_random_number_generator(ktc_to_cblock(&serviceKey)); + code = des_random_key(ktc_to_cblock(session)); if (code) return code; @@ -118,10 +112,7 @@ struct client { }; static long -Copious(c, buf, buflen) - IN struct client *c; - IN u_char *buf; - IN u_long buflen; +Copious(struct client *c, char *buf, u_long buflen) { long code; struct rx_call *call; @@ -130,7 +121,7 @@ Copious(c, buf, buflen) long outlen = c->recvLen; long d = 23; long mysum; - long outsum; + size_t outsum; mysum = 0; for (i = 0; i < inlen; i++) @@ -192,12 +183,10 @@ Copious(c, buf, buflen) } static long -DoClient(index, rock) - IN u_int index; - IN opaque rock; +DoClient(int index, opaque rock) { struct client *c = (struct client *)rock; - long code; + long code = 0; int i; u_long n, inc_n; @@ -224,7 +213,7 @@ DoClient(index, rock) if (c->copiousCalls[index] > 0) { u_long buflen = 10000; - u_char *buf = (u_char *) osi_Alloc(buflen); + char *buf = osi_Alloc(buflen); for (i = 0; i < c->copiousCalls[index]; i++) { code = Copious(c, buf, buflen); if (code) @@ -242,7 +231,7 @@ struct worker { long exitCode; /* is PROCESSRUNNING until exit */ int index; opaque rock; - long (*proc) (); + long (*proc) (int, opaque); }; #ifdef AFS_PTHREAD_ENV @@ -258,10 +247,10 @@ WorkerInit(void) #endif static struct worker *workers; -static long -DoWorker(w) - IN struct worker *w; +static void * +DoWorker(void * rock) { + struct worker *w = rock; long code; code = (*w->proc) (w->index, w->rock); #ifdef AFS_PTHREAD_ENV @@ -276,16 +265,13 @@ DoWorker(w) #else LWP_NoYieldSignal(&workers); #endif - return code; + return (void *)(intptr_t)code; } #define MAX_CTHREADS 25 static long -CallSimultaneously(threads, rock, proc) - IN u_int threads; - IN opaque rock; - IN long (*proc) (); +CallSimultaneously(u_int threads, opaque rock, long (*proc)(int, opaque)) { long code; int i; @@ -379,10 +365,7 @@ CallSimultaneously(threads, rock, proc) } static void -DivideUpCalls(calls, threads, threadCalls) - IN u_long calls; - IN u_int threads; - IN u_long threadCalls[]; +DivideUpCalls(u_long calls, u_int threads, u_long threadCalls[]) { int i; for (i = 0; i < threads; i++) { @@ -392,7 +375,7 @@ DivideUpCalls(calls, threads, threadCalls) } static double -ftime() +ftime(void) { struct timeval tv; gettimeofday(&tv, 0); @@ -400,9 +383,7 @@ ftime() } static long -RunLoadTest(parms, conn) - IN struct clientParms *parms; - IN struct rx_connection *conn; +RunLoadTest(struct clientParms *parms, struct rx_connection *conn) { long code; struct client c; @@ -436,7 +417,7 @@ RunLoadTest(parms, conn) parms->fastCalls + parms->slowCalls + parms->copiousCalls; int t = (interval / totalCalls) * 1000.0 + 0.5; if (totalCalls > 0) { - printf("For %d calls: %d msec/call\n", totalCalls, t); + printf("For %lu calls: %d msec/call\n", totalCalls, t); } if (parms->copiousCalls > 0) { long n = parms->sendLen + parms->recvLen; @@ -458,7 +439,7 @@ RunLoadTest(parms, conn) } #endif printf - ("For %d copious calls, %d send + %d recv = %d bytes each: %d kbytes/sec\n", + ("For %lu copious calls, %lu send + %lu recv = %lu bytes each: %d kbytes/sec\n", parms->copiousCalls, parms->sendLen, parms->recvLen, n, b); #if 0 printf("%g\n", kbps); @@ -469,9 +450,7 @@ RunLoadTest(parms, conn) } static long -RepeatLoadTest(parms, conn) - IN struct clientParms *parms; - IN struct rx_connection *conn; +RepeatLoadTest(struct clientParms *parms, struct rx_connection *conn) { long code; long count; @@ -528,14 +507,13 @@ struct multiChannel { int done; long *codes; int changes[RX_MAXCALLS]; - long callNumbers[RX_MAXCALLS]; + afs_int32 callNumbers[RX_MAXCALLS]; }; #define BIG_PRIME 1257056893 /* 0x4AED2A7d */ static u_long sequence = 0; static long -FastCall(conn) - IN struct rx_connection *conn; +FastCall(struct rx_connection *conn) { long code; u_long n = (sequence = sequence * BIG_PRIME + BIG_PRIME); @@ -550,13 +528,11 @@ FastCall(conn) } static long -UniChannelCall(index, rock) - IN u_int index; - IN opaque rock; +UniChannelCall(int index, opaque rock) { struct multiChannel *mc = (struct multiChannel *)rock; long code; - long callNumbers[RX_MAXCALLS]; + afs_int32 callNumbers[RX_MAXCALLS]; int unchanged; code = 0; @@ -585,11 +561,8 @@ UniChannelCall(index, rock) } static long -MakeMultiChannelCall(conn, each, expectedCode, codes) - IN struct rx_connection *conn; - IN int each; /* calls to make on each channel */ - IN long expectedCode; - OUT long codes[]; +MakeMultiChannelCall(struct rx_connection *conn, int each, + long expectedCode, long codes[]) { long code; int i; @@ -618,11 +591,8 @@ MakeMultiChannelCall(conn, each, expectedCode, codes) } static long -CheckCallFailure(conn, codes, code, msg) - IN struct rx_connection *conn; - IN long codes[]; - IN long code; - IN char *msg; +CheckCallFailure(struct rx_connection *conn, long codes[], long code, + char *msg) { if (code == 0) { fprintf(stderr, "Failed to detect %s\n", msg); @@ -651,7 +621,7 @@ CheckCallFailure(conn, codes, code, msg) sprintf(buf, "connection dead following %s", msg); code = FastCall(conn); if (code) - afs_com_err(whoami, code, buf); + afs_com_err(whoami, code, "%s", buf); } } } @@ -661,11 +631,8 @@ CheckCallFailure(conn, codes, code, msg) #endif /* rx_GetPacketCksum */ static long -RunCallTest(parms, host, sc, si) - IN struct clientParms *parms; - IN long host; - IN struct rx_securityClass *sc; - IN long si; +RunCallTest(struct clientParms *parms, long host, + struct rx_securityClass *sc, long si) { long code; @@ -681,7 +648,7 @@ RunCallTest(parms, host, sc, si) int i, ch; struct rx_connection *conn; long firstCall; - long callNumbers[RX_MAXCALLS]; + afs_int32 callNumbers[RX_MAXCALLS]; long codes[RX_MAXCALLS]; long retCode = 0; /* ret. if nothing fatal goes wrong */ @@ -877,9 +844,7 @@ static struct { #define IO_REDIRECTCHALLENGE 2 static int -HandleIncoming(p, addr) - INOUT struct rx_packet *p; - INOUT struct sockaddr_in *addr; +HandleIncoming(struct rx_packet *p, struct sockaddr_in *addr) { int client; /* packet sent by client */ u_char type; /* packet type */ @@ -933,9 +898,7 @@ static struct { #define OO_MUNGCKSUM 3 static int -HandleOutgoing(p, addr) - INOUT struct rx_packet *p; - INOUT struct sockaddr_in *addr; +HandleOutgoing(struct rx_packet *p, struct sockaddr_in *addr) { int client; /* packet sent by client */ u_char type; /* packet type */ @@ -1001,10 +964,10 @@ SlowCallInit(void) } #endif static long slowCallCode; -static long -SlowCall(conn) - IN opaque conn; +static void * +SlowCall(void * rock) { + struct rx_connection *conn = rock; u_long ntime; u_long now; long temp_rc; @@ -1031,17 +994,14 @@ SlowCall(conn) #else LWP_NoYieldSignal(&slowCallCode); #endif - return temp_rc; + return (void *)(intptr_t)temp_rc; } #endif /* rx_GetPacketCksum */ static long -RunHijackTest(parms, host, sc, si) - IN struct clientParms *parms; - IN long host; - IN struct rx_securityClass *sc; - IN long si; +RunHijackTest(struct clientParms *parms, long host, + struct rx_securityClass *sc, long si) { #ifndef rx_GetPacketCksum @@ -1053,9 +1013,6 @@ RunHijackTest(parms, host, sc, si) #else - extern int (*rx_justReceived) (); - extern int (*rx_almostSent) (); - long code; struct rx_connection *conn = 0; struct rx_connection *otherConn = 0; @@ -1269,8 +1226,7 @@ RunHijackTest(parms, host, sc, si) } long -rxkst_StartClient(parms) - IN struct clientParms *parms; +rxkst_StartClient(struct clientParms *parms) { long code; long host; @@ -1282,7 +1238,7 @@ rxkst_StartClient(parms) host = GetServer(parms->server); if (parms->authentication >= 0) { - long kvno; + long kvno = 0; char ticket[MAXKTCTICKETLEN]; int ticketLen; struct ktc_encryptionKey Ksession; diff --git a/src/rxkad/test/stress_internal.h b/src/rxkad/test/stress_internal.h index eca6614..f0cfa14 100644 --- a/src/rxkad/test/stress_internal.h +++ b/src/rxkad/test/stress_internal.h @@ -53,7 +53,7 @@ struct clientParms { }; long rxkst_StartClient(INOUT struct clientParms *parms); -long rxkst_StartServer(INOUT struct serverParms *parms); +void *rxkst_StartServer(void *rock); /* For backward compatibility with AFS3.0 release. */ @@ -78,10 +78,4 @@ typedef char *opaque; #define rxs_Release(a) RXS_Close(a) #endif -/* to keep GCC happy */ -extern int LWP_CreateProcess(); -extern char *lcstring(); -extern void exit(); -extern int cmd_AddParm(); -extern int cmd_Dispatch(); diff --git a/src/rxkad/test/stress_s.c b/src/rxkad/test/stress_s.c index 45902a0..219f7ec 100644 --- a/src/rxkad/test/stress_s.c +++ b/src/rxkad/test/stress_s.c @@ -33,14 +33,11 @@ #include "stress_internal.h" struct ktc_encryptionKey serviceKey = - { 0x45, 0xe3, 0x3d, 0x16, 0x29, 0x64, 0x8a, 0x8f }; + { { 0x45, 0xe3, 0x3d, 0x16, 0x29, 0x64, 0x8a, 0x8f } }; long serviceKeyVersion = 7; -static long -GetKey(rock, kvno, key) - IN char *rock; - IN long kvno; - OUT struct ktc_encryptionKey *key; +static int +GetKey(void *rock, int kvno, struct ktc_encryptionKey *key) { struct serverParms *parms = (struct serverParms *)rock; struct afsconf_keys tstr; @@ -78,10 +75,10 @@ GetKey(rock, kvno, key) static int minAuth; -long -rxkst_StartServer(parms) - INOUT struct serverParms *parms; +void * +rxkst_StartServer(void * rock) { + struct serverParms *parms = rock; extern int rx_stackSize; struct rx_service *tservice; struct rx_securityClass *sc[3]; @@ -117,8 +114,7 @@ static char test_client_inst[MAXKTCNAMELEN]; static char test_client_cell[MAXKTCREALMLEN]; static int got_client_id = 0; static long -CheckAuth(call) - IN struct rx_call *call; +CheckAuth(struct rx_call *call) { long code; int si; @@ -126,8 +122,8 @@ CheckAuth(call) char name[MAXKTCNAMELEN]; char inst[MAXKTCNAMELEN]; char cell[MAXKTCREALMLEN]; - long kvno; - u_long expiration; /* checked by Security Module */ + int kvno; + unsigned int expiration; /* checked by Security Module */ si = rx_SecurityClassOf(rx_ConnectionOf(call)); if (si == 1) { @@ -170,8 +166,7 @@ CheckAuth(call) /* Stop the server. There isn't a graceful way to do this so just exit. */ afs_int32 -SRXKST_Kill(call) - IN struct rx_call *call; +SRXKST_Kill(struct rx_call *call) { long code; code = CheckAuth(call); @@ -189,22 +184,17 @@ SRXKST_Kill(call) } afs_int32 -SRXKST_Fast(call, n, inc_nP) - IN struct rx_call *call; - IN u_long n; - OUT u_long *inc_nP; +SRXKST_Fast(struct rx_call *call, u_long n, u_long *inc_nP) { *inc_nP = n + 1; return 0; } afs_int32 -SRXKST_Slow(call, tag, nowP) - IN struct rx_call *call; - IN u_long tag; - OUT u_long *nowP; +SRXKST_Slow(struct rx_call *call, u_long tag, u_long *nowP) { long code; + time_t now; code = CheckAuth(call); if (code) return code; @@ -213,7 +203,8 @@ SRXKST_Slow(call, tag, nowP) #else IOMGR_Sleep(1); #endif - time(nowP); + time(&now); + *nowP = now; return 0; } @@ -223,23 +214,22 @@ static struct buflist { } *buflist = 0; static int bufAllocs = 0; -static u_char * -GetBuffer() +static char * +GetBuffer(void) { - u_char *ret; + char *ret; if (buflist) { - ret = (u_char *) buflist; + ret = (char *) buflist; buflist = buflist->next; } else { - ret = (u_char *) osi_Alloc(COPBUFSIZE); + ret = osi_Alloc(COPBUFSIZE); bufAllocs++; } return ret; } static void -PutBuffer(b) - IN u_char *b; +PutBuffer(char *b) { struct buflist *bl = (struct buflist *)b; bl->next = buflist; @@ -247,16 +237,12 @@ PutBuffer(b) } afs_int32 -SRXKST_Copious(call, inlen, insum, outlen, outsum) - IN struct rx_call *call; - IN u_long inlen; - IN u_long insum; - IN u_long outlen; - OUT u_long *outsum; +SRXKST_Copious(struct rx_call *call, u_long inlen, u_long insum, + u_long outlen, u_long *outsum) { long code; long mysum; - u_char *buf; + char *buf; int i; long b; long bytesTransfered;