kernelland_emu: Fix build following kernel mutex ABI changes.

This commit is contained in:
Augustin Cavalier
2024-09-10 16:13:25 -04:00
parent 65f942aada
commit bfc4b17442
@@ -9,6 +9,18 @@
#include <lock.h> #include <lock.h>
#if KDEBUG
#define KDEBUG_STATIC static
static status_t _mutex_lock(struct mutex* lock, void* locker);
static void _mutex_unlock(struct mutex* lock);
#else
#define KDEBUG_STATIC
#define mutex_lock mutex_lock_inline
#define mutex_unlock mutex_unlock_inline
#define mutex_trylock mutex_trylock_inline
#define mutex_lock_with_timeout mutex_lock_with_timeout_inline
#endif
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -730,7 +742,7 @@ _mutex_lock_threads_locked(mutex* lock)
} }
status_t KDEBUG_STATIC status_t
_mutex_lock(mutex* lock, void*) _mutex_lock(mutex* lock, void*)
{ {
AutoLocker<ThreadSpinlock> locker(sThreadSpinlock); AutoLocker<ThreadSpinlock> locker(sThreadSpinlock);
@@ -779,7 +791,7 @@ _mutex_unlock_threads_locked(mutex* lock)
} }
void KDEBUG_STATIC void
_mutex_unlock(mutex* lock) _mutex_unlock(mutex* lock)
{ {
AutoLocker<ThreadSpinlock> locker(sThreadSpinlock); AutoLocker<ThreadSpinlock> locker(sThreadSpinlock);
@@ -787,8 +799,9 @@ _mutex_unlock(mutex* lock)
} }
#undef mutex_trylock
status_t status_t
_mutex_trylock(mutex* lock) mutex_trylock(mutex* lock)
{ {
#if KDEBUG #if KDEBUG
AutoLocker<ThreadSpinlock> _(sThreadSpinlock); AutoLocker<ThreadSpinlock> _(sThreadSpinlock);
@@ -800,3 +813,27 @@ _mutex_trylock(mutex* lock)
#endif #endif
return B_WOULD_BLOCK; return B_WOULD_BLOCK;
} }
#undef mutex_lock
status_t
mutex_lock(mutex* lock)
{
#if KDEBUG
return _mutex_lock(lock, NULL);
#else
return mutex_lock_inline(lock);
#endif
}
#undef mutex_unlock
void
mutex_unlock(mutex* lock)
{
#if KDEBUG
_mutex_unlock(lock);
#else
mutex_unlock_inline(lock);
#endif
}