From: Derrick Brashear Date: Wed, 9 Oct 2002 01:54:48 +0000 (+0000) Subject: osi-wakeup-return-zero-on-doing-a-wakeup-20021008 X-Git-Tag: openafs-devel-1_3_50~576 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=32c2d6f846a8596273796893c8c16be36d564304;p=packages%2Fo%2Fopenafs.git osi-wakeup-return-zero-on-doing-a-wakeup-20021008 based on patch submitted by reuter@rzg.mpg.de, but i actually ported it to all platforms. --- diff --git a/src/afs/AIX/osi_sleep.c b/src/afs/AIX/osi_sleep.c index 32f5ca85f..1f225cf91 100644 --- a/src/afs/AIX/osi_sleep.c +++ b/src/afs/AIX/osi_sleep.c @@ -200,14 +200,17 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok) } -void afs_osi_Wakeup(void *event) +int afs_osi_Wakeup(void *event) { + int ret=1; struct afs_event *evp; evp = afs_getevent(event); if (evp->refcount > 1) { evp->seq++; e_wakeup(&evp->cond); + ret=0; } relevent(evp); + return ret; } diff --git a/src/afs/DARWIN/osi_sleep.c b/src/afs/DARWIN/osi_sleep.c index de0444546..c0f881cc6 100644 --- a/src/afs/DARWIN/osi_sleep.c +++ b/src/afs/DARWIN/osi_sleep.c @@ -199,10 +199,11 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok) } -void afs_osi_Wakeup(void *event) +int afs_osi_Wakeup(void *event) { struct afs_event *evp; - + int ret=1; + evp = afs_getevent(event); if (evp->refcount > 1) { evp->seq++; @@ -212,6 +213,8 @@ void afs_osi_Wakeup(void *event) #else thread_wakeup((event_t)event); #endif + ret=0; } relevent(evp); + return ret; } diff --git a/src/afs/DUX/osi_sleep.c b/src/afs/DUX/osi_sleep.c index 41718a169..f90b598ba 100644 --- a/src/afs/DUX/osi_sleep.c +++ b/src/afs/DUX/osi_sleep.c @@ -178,14 +178,17 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok) } -void afs_osi_Wakeup(void *event) +int afs_osi_Wakeup(void *event) { + int ret=1; struct afs_event *evp; - + evp = afs_getevent(event); if (evp->refcount > 1) { evp->seq++; thread_wakeup((vm_offset_t)(&evp->cond)); + ret=0; } relevent(evp); + return ret; } diff --git a/src/afs/FBSD/osi_sleep.c b/src/afs/FBSD/osi_sleep.c index 8e8d86117..60a3f9b53 100644 --- a/src/afs/FBSD/osi_sleep.c +++ b/src/afs/FBSD/osi_sleep.c @@ -180,14 +180,17 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok) } -void afs_osi_Wakeup(void *event) +int afs_osi_Wakeup(void *event) { + int ret=1; struct afs_event *evp; evp = afs_getevent(event); if (evp->refcount > 1) { evp->seq++; wakeup(event); + ret=0; } relevent(evp); + return ret; } diff --git a/src/afs/HPUX/osi_machdep.h b/src/afs/HPUX/osi_machdep.h index 24f1fef35..60853aeb1 100644 --- a/src/afs/HPUX/osi_machdep.h +++ b/src/afs/HPUX/osi_machdep.h @@ -83,7 +83,6 @@ extern void afsHashRelease(tid_t key); */ #define afs_osi_Sleep(x) sleep((caddr_t) x,PZERO-2) -#define afs_osi_Wakeup(x) wakeup((caddr_t) x) #define osi_NullHandle(x) ((x)->proc == (caddr_t) 0) extern caddr_t kmem_alloc(); diff --git a/src/afs/HPUX/osi_sleep.c b/src/afs/HPUX/osi_sleep.c index 16828d007..22394bff2 100644 --- a/src/afs/HPUX/osi_sleep.c +++ b/src/afs/HPUX/osi_sleep.c @@ -112,3 +112,9 @@ int afs_osi_SleepSig(void *event) afs_osi_Sleep(event); return 0; } + +int afs_osi_Wakeup(void *event) +{ + wakeup((caddr_t) event); + return 0; +} diff --git a/src/afs/IRIX/osi_sleep.c b/src/afs/IRIX/osi_sleep.c index 5e791fb19..12bfbfae9 100644 --- a/src/afs/IRIX/osi_sleep.c +++ b/src/afs/IRIX/osi_sleep.c @@ -183,14 +183,17 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok) } -void afs_osi_Wakeup(void *event) +int afs_osi_Wakeup(void *event) { + int ret=1; struct afs_event *evp; evp = afs_getevent(event); if (evp->refcount > 1) { evp->seq++; cv_broadcast(&evp->cond); + ret=0; } relevent(evp); + return ret; } diff --git a/src/afs/LINUX/osi_sleep.c b/src/afs/LINUX/osi_sleep.c index f3de7c51e..3ac172e7f 100644 --- a/src/afs/LINUX/osi_sleep.c +++ b/src/afs/LINUX/osi_sleep.c @@ -271,17 +271,20 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok) } -void afs_osi_Wakeup(void *event) +int afs_osi_Wakeup(void *event) { + int ret=2; struct afs_event *evp; evp = afs_getevent(event); if (!evp) /* No sleepers */ - return; + return 1; if (evp->refcount > 1) { evp->seq++; wake_up(&evp->cond); + ret=0; } relevent(evp); + return ret; } diff --git a/src/afs/NBSD/osi_sleep.c b/src/afs/NBSD/osi_sleep.c index 503373a0b..a22ff85e6 100644 --- a/src/afs/NBSD/osi_sleep.c +++ b/src/afs/NBSD/osi_sleep.c @@ -178,14 +178,17 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok) } -void afs_osi_Wakeup(void *event) +int afs_osi_Wakeup(void *event) { + int ret=1; struct afs_event *evp; evp = afs_getevent(event); if (evp->refcount > 1) { evp->seq++; thread_wakeup((vm_offset_t)(&evp->cond)); + ret=0; } relevent(evp); + return ret; } diff --git a/src/afs/SOLARIS/osi_sleep.c b/src/afs/SOLARIS/osi_sleep.c index 7f83ccc86..5ea0c595c 100644 --- a/src/afs/SOLARIS/osi_sleep.c +++ b/src/afs/SOLARIS/osi_sleep.c @@ -185,14 +185,17 @@ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok) } -void afs_osi_Wakeup(void *event) +int afs_osi_Wakeup(void *event) { + int ret=1; struct afs_event *evp; evp = afs_getevent(event); if (evp->refcount > 1) { evp->seq++; cv_broadcast(&evp->cond); + ret=0; } relevent(evp); + return 0; } diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 4958865e5..0499a9df7 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -1405,16 +1405,12 @@ static int afs_UFSCacheFetchProc(register struct rx_call *acall, abase += tlen; length -= tlen; adc->validPos = abase; -#ifdef AFS_AIX_ENV if (afs_osi_Wakeup(&adc->validPos) == 0) afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAKE, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__, ICL_TYPE_POINTER, adc, ICL_TYPE_INT32, adc->dflags); -#else - afs_osi_Wakeup(&adc->validPos); -#endif } } while (moredata); osi_FreeLargeSpace(tbuffer); @@ -2024,16 +2020,12 @@ RetryLookup: tdc->validPos = Position; /* which is AFS_CHUNKBASE(abyte) */ if (tdc->mflags & DFFetchReq) { tdc->mflags &= ~DFFetchReq; -#ifdef AFS_AIX_ENV if (afs_osi_Wakeup(&tdc->validPos) == 0) afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAKE, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__, ICL_TYPE_POINTER, tdc, ICL_TYPE_INT32, tdc->dflags); -#else - afs_osi_Wakeup(&tdc->validPos); -#endif } tsmall = (struct tlocal1 *) osi_AllocLargeSpace(sizeof(struct tlocal1)); setVcacheStatus = 0; @@ -2339,16 +2331,12 @@ RetryLookup: #endif /* AFS_NOSTATS */ tdc->dflags &= ~DFFetching; -#ifdef AFS_AIX_ENV if (afs_osi_Wakeup(&tdc->validPos) == 0) afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAKE, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__, ICL_TYPE_POINTER, tdc, ICL_TYPE_INT32, tdc->dflags); -#else - afs_osi_Wakeup(&tdc->validPos); -#endif if (avc->execsOrWriters == 0) tdc->f.states &= ~DWriting; /* now, if code != 0, we have an error and should punt. diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 79ff4a1b4..fc763f4b1 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -456,7 +456,7 @@ extern void afs_osi_InitWaitHandle(struct afs_osi_WaitHandle *achandle); extern void afs_osi_CancelWait(struct afs_osi_WaitHandle *achandle); extern int afs_osi_Wait(afs_int32 ams, struct afs_osi_WaitHandle *ahandle, int aintok); #ifndef afs_osi_Wakeup -extern void afs_osi_Wakeup(void *event); +extern int afs_osi_Wakeup(void *event); #endif #ifndef afs_osi_Sleep extern void afs_osi_Sleep(void *event); diff --git a/src/rx/rx_kernel.h b/src/rx/rx_kernel.h index d0843d318..e8e4e5228 100644 --- a/src/rx/rx_kernel.h +++ b/src/rx/rx_kernel.h @@ -25,27 +25,13 @@ typedef struct socket *osi_socket; #define OSI_NULLSOCKET ((osi_socket) 0) #if (!defined(AFS_GLOBAL_SUNLOCK) && !defined(RX_ENABLE_LOCKS)) -#define RX_KERNEL_TRACE 1 -#ifdef RX_KERNEL_TRACE #include "../afs/icl.h" #include "../afs/afs_trace.h" -#ifdef AFS_AIX_ENV +#endif #define osi_rxSleep(a) afs_Trace2(afs_iclSetp, CM_TRACE_RXSLEEP, \ ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__); afs_osi_Sleep(a) #define osi_rxWakeup(a) if (afs_osi_Wakeup(a) == 0) afs_Trace2(afs_iclSetp, \ CM_TRACE_RXWAKE, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__) -#else -#define osi_rxSleep(a) afs_osi_Sleep(a) -#define osi_rxWakeup(a) afs_osi_Wakeup(a) -#endif -#else /* RX_KERNEL_TRACE */ -#define osi_rxSleep(a) afs_osi_Sleep(a) -#define osi_rxWakeup(a) afs_osi_Wakeup(a) -#endif /* RX_KERNEL_TRACE */ -#else /* AFS_GLOBAL_SUNLOCK || RX_ENABLE_LOCKS */ -#define osi_rxSleep(a) afs_osi_Sleep(a) -#define osi_rxWakeup(a) afs_osi_Wakeup(a) -#endif extern int osi_utoa(char *buf, size_t len, unsigned long val); #define osi_Assert(e) (void)((e) || (osi_AssertFailK(#e, __FILE__, __LINE__), 0))