/*
- * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#include <kern/queue.h>
extern void lck_mod_init(
- void) __attribute__((section("__TEXT, initcode")));
+ void);
typedef unsigned int lck_type_t;
#define LCK_SLEEP_SHARED 0x02 /* Reclaim the lock in shared mode (RW only) */
#define LCK_SLEEP_EXCLUSIVE 0x04 /* Reclaim the lock in exclusive mode (RW only) */
#define LCK_SLEEP_SPIN 0x08 /* Reclaim the lock in spin mode (mutex only) */
+#define LCK_SLEEP_PROMOTED_PRI 0x10 /* Sleep at a promoted priority */
-#define LCK_SLEEP_MASK 0x0f /* Valid actions */
+#define LCK_SLEEP_MASK 0x1f /* Valid actions */
#ifdef MACH_KERNEL_PRIVATE
#ifdef KERNEL_PRIVATE
-extern boolean_t lck_spin_try_lock(
- lck_spin_t *lck);
+extern boolean_t lck_spin_try_lock( lck_spin_t *lck);
+
+/* NOT SAFE: To be used only by kernel debugger to avoid deadlock. */
+extern boolean_t lck_spin_is_acquired( lck_spin_t *lck);
struct _lck_mtx_ext_;
extern void lck_mtx_init_ext(lck_mtx_t *lck, struct _lck_mtx_ext_ *lck_ext,
extern void lck_mtx_lock(
lck_mtx_t *lck);
-#if defined(__i386__)
-extern void lck_mtx_unlock(lck_mtx_t *lck) __DARWIN10_ALIAS(lck_mtx_unlock);
-#else
extern void lck_mtx_unlock(
lck_mtx_t *lck);
-#endif /* __i386__ */
extern void lck_mtx_destroy(
lck_mtx_t *lck,
extern boolean_t lck_mtx_try_lock_spin(
lck_mtx_t *lck);
+extern boolean_t lck_mtx_try_lock_spin_always(
+ lck_mtx_t *lck);
+
extern void lck_mtx_lock_spin_always(
lck_mtx_t *lck);
#else
#define lck_mtx_try_lock_spin(l) lck_mtx_try_lock(l)
#define lck_mtx_lock_spin(l) lck_mtx_lock(l)
+#define lck_mtx_try_lock_spin_always(l) lck_spin_try_lock(l)
#define lck_mtx_lock_spin_always(l) lck_spin_lock(l)
#define lck_mtx_unlock_always(l) lck_spin_unlock(l)
#define lck_mtx_convert_spin(l) do {} while (0)
#ifdef XNU_KERNEL_PRIVATE
#define LCK_RW_ASSERT_SHARED 0x01
#define LCK_RW_ASSERT_EXCLUSIVE 0x02
-#define LCK_RW_ASSERT_HELD (LCK_RW_ASSERT_SHARED | LCK_RW_ASSERT_EXCLUSIVE)
+#define LCK_RW_ASSERT_HELD 0x03
+#define LCK_RW_ASSERT_NOTHELD 0x04
#endif
__BEGIN_DECLS
extern void lck_rw_assert(
lck_rw_t *lck,
unsigned int type);
+
+extern void lck_rw_clear_promotion(
+ thread_t thread);
#endif
#ifdef KERNEL_PRIVATE