From 7827ac9af178b5c4a0d42b2ff87ca7b012a513ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Love=20H=C3=B6rnquist-=C3=85strand?= Date: Sat, 19 Jan 2002 09:25:19 +0000 Subject: [PATCH] alpha-cleanup-20020119 make alpha AFS_64BIT_ENV Avoid warning by not passing data inside a pointer in the test program rw. Provide compatibility symbols for those w/o preempt hack so its possible to link test program `rw'. When comparing to lwp_cpptr->statcheck, cast to int, since that is the type of lwp_cpptr->statcheck. It may be the case that sizeof(int) != sizeof(afs_int32), but then other things will break too. clean tests with -f ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== and unbreak linux --- src/config/param.alpha_nbsd15.h | 2 ++ src/lwp/lwp.c | 8 ++++---- src/lwp/preempt.c | 18 ++++++++++++++++-- src/lwp/preempt.h | 4 +++- src/lwp/rw.c | 16 ++++++++++------ src/tests/Makefile.in | 2 +- 6 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/config/param.alpha_nbsd15.h b/src/config/param.alpha_nbsd15.h index 918a4f29c..f592eb135 100644 --- a/src/config/param.alpha_nbsd15.h +++ b/src/config/param.alpha_nbsd15.h @@ -5,6 +5,8 @@ #define AFS_ALPHA_ENV 1 #define AFS_ALPHA_XBSD_ENV 1 +#define AFS_64BIT_ENV 1 + #define AFS_ALPHA_ENV 1 #define SYS_NAME "alpha_nbsd15" diff --git a/src/lwp/lwp.c b/src/lwp/lwp.c index 856934377..ac04876cb 100644 --- a/src/lwp/lwp.c +++ b/src/lwp/lwp.c @@ -837,12 +837,12 @@ static int Dispatcher() /* Lightweight process dispatcher */ lwp_cpptr->stack + lwp_cpptr->stacksize - 4)) { #else if (lwp_cpptr && lwp_cpptr->stack && - (lwp_cpptr->stackcheck != *(afs_int32 *)(lwp_cpptr->stack) || + (lwp_cpptr->stackcheck != *(int *)(lwp_cpptr->stack) || lwp_cpptr->context.topstack < lwp_cpptr->stack || lwp_cpptr->context.topstack > (lwp_cpptr->stack + lwp_cpptr->stacksize))) { #endif printf("stackcheck = %u: stack = %u \n", - lwp_cpptr->stackcheck, *(afs_int32 *)lwp_cpptr->stack); + lwp_cpptr->stackcheck, *(int *)lwp_cpptr->stack); printf("topstack = 0x%x: stackptr = 0x%x: stacksize = 0x%x\n", lwp_cpptr->context.topstack, lwp_cpptr->stack, lwp_cpptr->stacksize); @@ -953,10 +953,10 @@ static void Initialize_PCB(temp, priority, stack, stacksize, ep, parm, name) temp -> stacksize = stacksize; #ifdef __hp9000s800 if (temp -> stack != NULL) - temp -> stackcheck = *(afs_int32 *) ((temp -> stack) + stacksize - 4); + temp -> stackcheck = *(int *) ((temp -> stack) + stacksize - 4); #else if (temp -> stack != NULL) - temp -> stackcheck = *(afs_int32 *) (temp -> stack); + temp -> stackcheck = *(int *) (temp -> stack); #endif temp -> ep = ep; temp -> parm = parm; diff --git a/src/lwp/preempt.c b/src/lwp/preempt.c index ff6bd0d50..4e60898d9 100644 --- a/src/lwp/preempt.c +++ b/src/lwp/preempt.c @@ -19,14 +19,28 @@ RCSID("$Header$"); +#include "lwp.h" +#include "preempt.h" + #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_DJGPP_ENV) int PRE_Block = 0; + + +int PRE_InitPreempt(slice) + struct timeval *slice; +{ + return LWP_SUCCESS; +} + +int PRE_EndPreempt() +{ + return LWP_SUCCESS; +} + #else #include #include #include -#include "lwp.h" -#include "preempt.h" #if defined(AFS_OSF_ENV) || defined(AFS_S390_LINUX20_ENV) int PRE_Block = 0; /* used in lwp.c and process.s */ diff --git a/src/lwp/preempt.h b/src/lwp/preempt.h index e4fe79c48..e295ab60a 100644 --- a/src/lwp/preempt.h +++ b/src/lwp/preempt.h @@ -14,10 +14,12 @@ * * \*******************************************************************/ +#if defined( _WIN32) +#define PRE_InitPreempt(A) +#endif #if defined( _WIN32) || defined(AFS_LINUX20_ENV) /* preemption not implemented for win32. Use threads instead. */ -#define PRE_InitPreempt(A) #define PRE_PreemptMe() #define PRE_BeginCritical() #define PRE_EndCritical() diff --git a/src/lwp/rw.c b/src/lwp/rw.c index ae7bf012a..d10421ce0 100644 --- a/src/lwp/rw.c +++ b/src/lwp/rw.c @@ -27,6 +27,7 @@ RCSID("$Header$"); extern char *calloc(); #endif #include +#include #include "lwp.h" #include "lock.h" @@ -96,9 +97,9 @@ int asleep; /* Number of processes sleeping -- used for clean termination */ static int read_process(id) - int id; + int *id; { - printf("\t[Reader %d]\n", id); + printf("\t[Reader %d]\n", *id); LWP_DispatchProcess(); /* Just relinquish control for now */ PRE_PreemptMe(); @@ -116,7 +117,7 @@ static int read_process(id) asleep--; for (i=0; i<10000; i++) ; PRE_BeginCritical(); - printf("[%d: %s]\n", id, Remove(q)); + printf("[%d: %s]\n", *id, Remove(q)); PRE_EndCritical(); ReleaseReadLock(&q->lock); LWP_DispatchProcess(); @@ -201,8 +202,10 @@ main(argc, argv) int argc; char **argv; { int nreaders, i; + PROCESS pid; afs_int32 interval; /* To satisfy Brad */ PROCESS *readers; + int *readerid; PROCESS writer; struct timeval tv; @@ -219,7 +222,7 @@ main(argc, argv) interval = (argc >= 3 ? atoi(*++argv)*1000 : 50000); if (argc == 4) lwp_debug = 1; - LWP_InitializeProcessSupport(0, (PROCESS*)&i); + LWP_InitializeProcessSupport(0, &pid); printf("[Support initialized]\n"); tv.tv_sec = 0; tv.tv_usec = interval; @@ -235,9 +238,10 @@ main(argc, argv) /* Now create readers */ printf("[Creating Readers...\n"); readers = (PROCESS *) calloc(nreaders, sizeof(PROCESS)); + readerid = (int *)calloc(nreaders, sizeof(i)); for (i=0; i