From da3cb37d99fd984eca5ed3af780a89489b1ca118 Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Thu, 23 Jan 2003 20:34:58 +0000 Subject: [PATCH] openbsd-20030123 Mindless tweaking in search of a bug. --- src/rx/OBSD/rx_kmutex.h | 29 +++++++---------------------- src/rx/OBSD/rx_knet.c | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/src/rx/OBSD/rx_kmutex.h b/src/rx/OBSD/rx_kmutex.h index 06ecb39da..d19b92611 100644 --- a/src/rx/OBSD/rx_kmutex.h +++ b/src/rx/OBSD/rx_kmutex.h @@ -21,11 +21,16 @@ /* You can't have AFS_GLOBAL_SUNLOCK and not RX_ENABLE_LOCKS */ #define RX_ENABLE_LOCKS 1 #define AFS_GLOBAL_RXLOCK_KERNEL +#ifndef AFS_GLOBAL_SUNLOCK +#define AFS_ASSERT_RXGLOCK() +#endif /* This is incomplete and probably wouldn't work with NCPUS > 1 */ typedef int afs_kcondvar_t; +#define CV_INIT(cv, a, b, c) +#define CV_DESTROY(cv) #define CV_WAIT(cv, lck) { \ int isGlockOwner = ISAFS_GLOCK(); \ if (isGlockOwner) AFS_GUNLOCK(); \ @@ -38,18 +43,13 @@ typedef int afs_kcondvar_t; #define CV_BROADCAST(cv) wakeup(cv) typedef struct { - struct lock lock; struct proc *owner; } afs_kmutex_t; #define MUTEX_DEFAULT 0 -#ifdef USE_REAL_MUTEX -/* This doesn't seem to work yet */ -#define MUTEX_ISMINE(a) (((afs_kmutex_t *)(a))->owner == curproc) #define MUTEX_INIT(a,b,c,d) \ do { \ - lockinit(&(a)->lock,PSOCK, "afs rx mutex", 0, 0); \ (a)->owner = 0; \ } while(0); #define MUTEX_DESTROY(a) \ @@ -58,31 +58,16 @@ typedef struct { } while(0); #define MUTEX_ENTER(a) \ do { \ - lockmgr(&(a)->lock, LK_EXCLUSIVE, 0, curproc); \ osi_Assert((a)->owner == 0); \ (a)->owner = curproc; \ } while(0); #define MUTEX_TRYENTER(a) \ - ( lockmgr(&(a)->lock, LK_EXCLUSIVE|LK_NOWAIT, 0, curproc) ? 0 : ((a)->owner = curproc, 1) ) + ( osi_Assert((a)->owner == 0), (a)->owner = curproc, 1) #define MUTEX_EXIT(a) \ do { \ osi_Assert((a)->owner == curproc); \ (a)->owner = 0; \ - lockmgr(&(a)->lock, LK_RELEASE, 0, curproc); \ } while(0); -#else /* USE_REAL_MUTEX */ -#define MUTEX_ISMINE(a) 1 -#define MUTEX_INIT(a,b,c,d) -#define MUTEX_DESTROY(a) -#define MUTEX_ENTER(a) -#define MUTEX_TRYENTER(a) 1 -#define MUTEX_EXIT(a) -#endif /* USE_REAL_MUTEX */ - -#define CV_INIT(a,b,c,d) -#define CV_DESTROY(a) -#ifndef AFS_GLOBAL_SUNLOCK -#define AFS_ASSERT_RXGLOCK() -#endif +#define MUTEX_ISMINE(a) (((afs_kmutex_t *)(a))->owner == curproc) #endif /* _RX_KMUTEX_H_ */ diff --git a/src/rx/OBSD/rx_knet.c b/src/rx/OBSD/rx_knet.c index ad9c36793..26b226da8 100644 --- a/src/rx/OBSD/rx_knet.c +++ b/src/rx/OBSD/rx_knet.c @@ -27,10 +27,8 @@ int osi_NetReceive(osi_socket asocket, struct sockaddr_in *addr, struct iovec *d if (nvecs > RX_MAXIOVECS) osi_Panic("osi_NetReceive: %d: too many iovecs\n", nvecs); - for (i = 0 ; i < nvecs ; i++) { - iov[i].iov_base = dvec[i].iov_base; - iov[i].iov_len = dvec[i].iov_len; - } + for (i = 0 ; i < nvecs ; i++) + iov[i] = dvec[i]; u.uio_iov = &iov[0]; u.uio_iovcnt = nvecs; @@ -46,8 +44,12 @@ int osi_NetReceive(osi_socket asocket, struct sockaddr_in *addr, struct iovec *d if (haveGlock) AFS_GLOCK(); - if (code && afs_termState != AFSOP_STOP_RXK_LISTENER) { - afs_osi_Sleep(&afs_termState); + if (code) { +#ifdef RXKNET_DEBUG + printf("rx code %d termState %d\n", code, afs_termState); +#endif + while (afs_termState == AFSOP_STOP_RXEVENT) + afs_osi_Sleep(&afs_termState); return code; } @@ -101,10 +103,8 @@ int osi_NetSend(osi_socket asocket, struct sockaddr_in *addr, if (nvecs > RX_MAXIOVECS) osi_Panic("osi_NetSend: %d: Too many iovecs.\n", nvecs); - for (i = 0; i < nvecs; i++) { - iov[i].iov_base = dvec[i].iov_base; - iov[i].iov_len = dvec[i].iov_len; - } + for (i = 0; i < nvecs; i++) + iov[i] = dvec[i]; u.uio_iov = &iov[0]; u.uio_iovcnt = nvecs; -- 2.39.5