X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=tdb%2Fspinlock.c;h=50cd952c727a0cc7c72df7fbd08034f3771fa1eb;hp=2370ce3bdd93286d8c86e3f7c410a3e0ad1e37a4;hb=ac28b86d631f23b5df74dbeb33e76a2b3f5d88bb;hpb=5ac4a56b39fed9d95850161864befe612b1a538e diff --git a/tdb/spinlock.c b/tdb/spinlock.c index 2370ce3bd..50cd952c7 100644 --- a/tdb/spinlock.c +++ b/tdb/spinlock.c @@ -17,11 +17,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* udev defines */ +#define STANDALONE +#define TDB_DEBUG +#define HAVE_MMAP 1 +#include "../udev.h" + #if HAVE_CONFIG_H #include #endif -#if STANDALONE +#ifdef STANDALONE +#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #include #include @@ -34,7 +41,6 @@ #include "tdb.h" #include "spinlock.h" -#define DEBUG #else #include "includes.h" #endif @@ -293,10 +299,8 @@ static void __write_unlock(tdb_rwlock_t *rwlock) { __spin_lock(&rwlock->lock); -#ifdef DEBUG if (!(rwlock->count & RWLOCK_BIAS)) - fprintf(stderr, "bug: write_unlock\n"); -#endif + dbg("bug: write_unlock"); rwlock->count &= ~RWLOCK_BIAS; __spin_unlock(&rwlock->lock); @@ -306,13 +310,11 @@ static void __read_unlock(tdb_rwlock_t *rwlock) { __spin_lock(&rwlock->lock); -#ifdef DEBUG if (!rwlock->count) - fprintf(stderr, "bug: read_unlock\n"); + dbg("bug: read_unlock"); if (rwlock->count & RWLOCK_BIAS) - fprintf(stderr, "bug: read_unlock\n"); -#endif + dbg("bug: read_unlock"); rwlock->count--; __spin_unlock(&rwlock->lock);