From: Simon Wilkinson Date: Wed, 22 Aug 2012 08:31:03 +0000 (+0100) Subject: util: Don't use rx-internal locking macros X-Git-Tag: openafs-stable-1_8_0pre1~2055 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=0b31aba6a6aa9440bfa4e957d6e90cd6ae3c8b16 util: Don't use rx-internal locking macros The MUTEX_INIT, MUTEX_ENTER, MUTEX_EXIT and MUTEX_DESTROY macros are intended for RX internal use only (they're an abstraction interface so that the same locking code can be used in userspace and in the kernel). They aren't appropriate for general purpose use. Just use pthread calls directly for the serverLog locks. Change-Id: I8373eaa097c36f7d3a4c9b0501fc5e897372582e Reviewed-on: http://gerrit.openafs.org/8031 Reviewed-by: Jeffrey Altman Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/util/serverLog.c b/src/util/serverLog.c index f7bbb5c..98211a4 100644 --- a/src/util/serverLog.c +++ b/src/util/serverLog.c @@ -31,12 +31,10 @@ #include #if defined(AFS_PTHREAD_ENV) -/* can't include rx when we are libutil; it's too early */ -#include #include static pthread_mutex_t serverLogMutex; -#define LOCK_SERVERLOG() MUTEX_ENTER(&serverLogMutex) -#define UNLOCK_SERVERLOG() MUTEX_EXIT(&serverLogMutex) +#define LOCK_SERVERLOG() opr_Verify(pthread_mutex_lock(&serverLogMutex) == 0); +#define UNLOCK_SERVERLOG() opr_Verify(pthread_mutex_unlock(&serverLogMutex) == 0); #ifdef AFS_NT40_ENV #define NULLDEV "NUL" @@ -340,7 +338,7 @@ OpenLog(const char *fileName) #endif #if defined(AFS_PTHREAD_ENV) - MUTEX_INIT(&serverLogMutex, "serverlog", MUTEX_DEFAULT, 0); + opr_Verify(pthread_mutex_init(&serverLogMutex, NULL) == 0); #endif /* AFS_PTHREAD_ENV */ serverLogFD = tempfd;