${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
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}
#include <afs/afsutil.h>
#include <rx/rxkad.h>
#include <afs/auth.h>
+#include <des_prototypes.h>
#include "stress.h"
#include "stress_internal.h"
#ifdef AFS_PTHREAD_ENV
static char *whoami;
static long
-GetServer(aname)
- IN char *aname;
+GetServer(const char *aname)
{
struct hostent *th;
long addr;
}
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;
}
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;
};
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;
long outlen = c->recvLen;
long d = 23;
long mysum;
- long outsum;
+ size_t outsum;
mysum = 0;
for (i = 0; i < inlen; i++)
}
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;
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)
long exitCode; /* is PROCESSRUNNING until exit */
int index;
opaque rock;
- long (*proc) ();
+ long (*proc) (int, opaque);
};
#ifdef AFS_PTHREAD_ENV
#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
#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;
}
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++) {
}
static double
-ftime()
+ftime(void)
{
struct timeval tv;
gettimeofday(&tv, 0);
}
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;
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;
}
#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);
}
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;
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);
}
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;
}
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;
}
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);
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);
}
}
}
#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;
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 */
#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 */
#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 */
}
#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;
#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
#else
- extern int (*rx_justReceived) ();
- extern int (*rx_almostSent) ();
-
long code;
struct rx_connection *conn = 0;
struct rx_connection *otherConn = 0;
}
long
-rxkst_StartClient(parms)
- IN struct clientParms *parms;
+rxkst_StartClient(struct clientParms *parms)
{
long code;
long host;
host = GetServer(parms->server);
if (parms->authentication >= 0) {
- long kvno;
+ long kvno = 0;
char ticket[MAXKTCTICKETLEN];
int ticketLen;
struct ktc_encryptionKey Ksession;
#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;
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];
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;
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) {
/* 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);
}
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;
#else
IOMGR_Sleep(1);
#endif
- time(nowP);
+ time(&now);
+ *nowP = now;
return 0;
}
} *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;
}
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;