| 1 |
// Like the compiler, the static analyzer treats some functions differently if |
| 2 |
// they come from a system header -- for example, pthread_mutex* functions |
| 3 |
// should not invalidate regions of their arguments. |
| 4 |
#pragma clang system_header |
| 5 |
|
| 6 |
typedef struct { |
| 7 |
void *foo; |
| 8 |
} pthread_mutex_t; |
| 9 |
|
| 10 |
typedef struct { |
| 11 |
void *foo; |
| 12 |
} pthread_mutexattr_t; |
| 13 |
|
| 14 |
typedef struct { |
| 15 |
void *foo; |
| 16 |
} lck_grp_t; |
| 17 |
|
| 18 |
typedef struct { |
| 19 |
void *foo; |
| 20 |
} lck_rw_t; |
| 21 |
|
| 22 |
typedef pthread_mutex_t lck_mtx_t; |
| 23 |
|
| 24 |
extern void fake_system_function(); |
| 25 |
extern void fake_system_function_that_takes_a_mutex(pthread_mutex_t *mtx); |
| 26 |
|
| 27 |
extern int pthread_mutex_lock(pthread_mutex_t *); |
| 28 |
extern int pthread_mutex_unlock(pthread_mutex_t *); |
| 29 |
extern int pthread_mutex_trylock(pthread_mutex_t *); |
| 30 |
extern int pthread_mutex_destroy(pthread_mutex_t *); |
| 31 |
extern int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr); |
| 32 |
|
| 33 |
typedef int boolean_t; |
| 34 |
extern void lck_mtx_lock(lck_mtx_t *); |
| 35 |
extern void lck_mtx_unlock(lck_mtx_t *); |
| 36 |
extern boolean_t lck_mtx_try_lock(lck_mtx_t *); |
| 37 |
extern void lck_mtx_destroy(lck_mtx_t *lck, lck_grp_t *grp); |
| 38 |
|
| 39 |
extern void lck_rw_lock_exclusive(lck_rw_t *lck); |
| 40 |
extern void lck_rw_unlock_exclusive(lck_rw_t *lck); |
| 41 |
extern void lck_rw_lock_shared(lck_rw_t *lck); |
| 42 |
extern void lck_rw_unlock_shared(lck_rw_t *lck); |