]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/locks.h
xnu-2782.1.97.tar.gz
[apple/xnu.git] / osfmk / kern / locks.h
index 659336194cd76b8cac6ade2ac905186919280ee2..425c8dc7e2b1b767a7424b234aa3d7c71f7e2664 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -40,7 +40,7 @@
 #include       <kern/queue.h>
 
 extern void                            lck_mod_init(
-                                                               void) __attribute__((section("__TEXT, initcode")));
+                                                               void);
 
 typedef        unsigned int    lck_type_t;
 
@@ -58,8 +58,9 @@ typedef       unsigned int            lck_sleep_action_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
 
@@ -263,8 +264,10 @@ extern wait_result_t       lck_spin_sleep_deadline(
 
 #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,
@@ -286,12 +289,8 @@ extern void                                lck_mtx_init(
 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,
@@ -328,6 +327,9 @@ extern void                         lck_mtx_yield (
 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);
 
@@ -342,6 +344,7 @@ extern void                 lck_mtx_convert_spin(
 #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)
@@ -387,7 +390,8 @@ typedef unsigned int         lck_rw_type_t;
 #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
@@ -430,6 +434,9 @@ extern void                         lck_rw_unlock_exclusive(
 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