1#ifndef _LOCK_H_ 2#define _LOCK_H_ 3 4#ifdef MACH_KERNEL_PRIVATE 5#include <arm/locks.h> 6typedef lck_rw_t lock_t; 7#endif 8 9#if defined(MACH_KERNEL_PRIVATE) && defined(__APPLE_API_PRIVATE) 10#include <mach_ldebug.h> 11 12#if MACH_LDEBUG 13#define USLOCK_DEBUG 1 14#else 15#define USLOCK_DEBUG 0 16#endif /* USLOCK_DEBUG */ 17 18typedef struct uslock_debug { 19 void *lock_pc; /* pc where lock operation began */ 20 void *lock_thread; /* thread that acquired lock */ 21 void *unlock_thread; /* last thread to release lock */ 22 void *unlock_pc; /* pc where lock operation ended */ 23 unsigned long duration[2]; 24 unsigned short state; 25 unsigned char lock_cpu; 26 unsigned char unlock_cpu; 27} uslock_debug; 28 29typedef struct slock { 30 hw_lock_data_t interlock; /* must be first... see lock.c */ 31#if USLOCK_DEBUG 32 unsigned short lock_type; /* must be second... see lock.c */ 33#define USLOCK_TAG 0x5353 34 uslock_debug debug; 35#endif 36} usimple_lock_data_t, *usimple_lock_t; 37 38#else 39 40typedef struct slock { 41 unsigned long lock_data[10]; 42} usimple_lock_data_t, *usimple_lock_t; 43 44#endif /* defined(MACH_KERNEL_PRIVATE) && defined(__APPLE_API_PRIVATE) */ 45 46#define USIMPLE_LOCK_NULL ((usimple_lock_t) 0) 47 48#if !defined(decl_simple_lock_data) 49typedef usimple_lock_data_t *simple_lock_t; 50typedef usimple_lock_data_t simple_lock_data_t; 51 52#define decl_simple_lock_data(class,name) \ 53 class simple_lock_data_t name; 54 55#endif /* !defined(decl_simple_lock_data) */ 56 57extern unsigned int LockTimeOut; 58 59#endif 60