diff options
Diffstat (limited to 'tools/lib/lockdep')
-rw-r--r-- | tools/lib/lockdep/include/liblockdep/mutex.h | 4 | ||||
-rw-r--r-- | tools/lib/lockdep/include/liblockdep/rwlock.h | 8 | ||||
-rw-r--r-- | tools/lib/lockdep/preload.c | 20 |
3 files changed, 15 insertions, 17 deletions
diff --git a/tools/lib/lockdep/include/liblockdep/mutex.h b/tools/lib/lockdep/include/liblockdep/mutex.h index c342f7087147..ee53a42818ca 100644 --- a/tools/lib/lockdep/include/liblockdep/mutex.h +++ b/tools/lib/lockdep/include/liblockdep/mutex.h | |||
@@ -35,7 +35,7 @@ static inline int __mutex_init(liblockdep_pthread_mutex_t *lock, | |||
35 | 35 | ||
36 | static inline int liblockdep_pthread_mutex_lock(liblockdep_pthread_mutex_t *lock) | 36 | static inline int liblockdep_pthread_mutex_lock(liblockdep_pthread_mutex_t *lock) |
37 | { | 37 | { |
38 | lock_acquire(&lock->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 38 | lock_acquire(&lock->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
39 | return pthread_mutex_lock(&lock->mutex); | 39 | return pthread_mutex_lock(&lock->mutex); |
40 | } | 40 | } |
41 | 41 | ||
@@ -47,7 +47,7 @@ static inline int liblockdep_pthread_mutex_unlock(liblockdep_pthread_mutex_t *lo | |||
47 | 47 | ||
48 | static inline int liblockdep_pthread_mutex_trylock(liblockdep_pthread_mutex_t *lock) | 48 | static inline int liblockdep_pthread_mutex_trylock(liblockdep_pthread_mutex_t *lock) |
49 | { | 49 | { |
50 | lock_acquire(&lock->dep_map, 0, 1, 0, 2, NULL, (unsigned long)_RET_IP_); | 50 | lock_acquire(&lock->dep_map, 0, 1, 0, 1, NULL, (unsigned long)_RET_IP_); |
51 | return pthread_mutex_trylock(&lock->mutex) == 0 ? 1 : 0; | 51 | return pthread_mutex_trylock(&lock->mutex) == 0 ? 1 : 0; |
52 | } | 52 | } |
53 | 53 | ||
diff --git a/tools/lib/lockdep/include/liblockdep/rwlock.h b/tools/lib/lockdep/include/liblockdep/rwlock.h index a680ab8c2e36..4ec03f861551 100644 --- a/tools/lib/lockdep/include/liblockdep/rwlock.h +++ b/tools/lib/lockdep/include/liblockdep/rwlock.h | |||
@@ -36,7 +36,7 @@ static inline int __rwlock_init(liblockdep_pthread_rwlock_t *lock, | |||
36 | 36 | ||
37 | static inline int liblockdep_pthread_rwlock_rdlock(liblockdep_pthread_rwlock_t *lock) | 37 | static inline int liblockdep_pthread_rwlock_rdlock(liblockdep_pthread_rwlock_t *lock) |
38 | { | 38 | { |
39 | lock_acquire(&lock->dep_map, 0, 0, 2, 2, NULL, (unsigned long)_RET_IP_); | 39 | lock_acquire(&lock->dep_map, 0, 0, 2, 1, NULL, (unsigned long)_RET_IP_); |
40 | return pthread_rwlock_rdlock(&lock->rwlock); | 40 | return pthread_rwlock_rdlock(&lock->rwlock); |
41 | 41 | ||
42 | } | 42 | } |
@@ -49,19 +49,19 @@ static inline int liblockdep_pthread_rwlock_unlock(liblockdep_pthread_rwlock_t * | |||
49 | 49 | ||
50 | static inline int liblockdep_pthread_rwlock_wrlock(liblockdep_pthread_rwlock_t *lock) | 50 | static inline int liblockdep_pthread_rwlock_wrlock(liblockdep_pthread_rwlock_t *lock) |
51 | { | 51 | { |
52 | lock_acquire(&lock->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 52 | lock_acquire(&lock->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
53 | return pthread_rwlock_wrlock(&lock->rwlock); | 53 | return pthread_rwlock_wrlock(&lock->rwlock); |
54 | } | 54 | } |
55 | 55 | ||
56 | static inline int liblockdep_pthread_rwlock_tryrdlock(liblockdep_pthread_rwlock_t *lock) | 56 | static inline int liblockdep_pthread_rwlock_tryrdlock(liblockdep_pthread_rwlock_t *lock) |
57 | { | 57 | { |
58 | lock_acquire(&lock->dep_map, 0, 1, 2, 2, NULL, (unsigned long)_RET_IP_); | 58 | lock_acquire(&lock->dep_map, 0, 1, 2, 1, NULL, (unsigned long)_RET_IP_); |
59 | return pthread_rwlock_tryrdlock(&lock->rwlock) == 0 ? 1 : 0; | 59 | return pthread_rwlock_tryrdlock(&lock->rwlock) == 0 ? 1 : 0; |
60 | } | 60 | } |
61 | 61 | ||
62 | static inline int liblockdep_pthread_rwlock_trywlock(liblockdep_pthread_rwlock_t *lock) | 62 | static inline int liblockdep_pthread_rwlock_trywlock(liblockdep_pthread_rwlock_t *lock) |
63 | { | 63 | { |
64 | lock_acquire(&lock->dep_map, 0, 1, 0, 2, NULL, (unsigned long)_RET_IP_); | 64 | lock_acquire(&lock->dep_map, 0, 1, 0, 1, NULL, (unsigned long)_RET_IP_); |
65 | return pthread_rwlock_trywlock(&lock->rwlock) == 0 ? 1 : 0; | 65 | return pthread_rwlock_trywlock(&lock->rwlock) == 0 ? 1 : 0; |
66 | } | 66 | } |
67 | 67 | ||
diff --git a/tools/lib/lockdep/preload.c b/tools/lib/lockdep/preload.c index 23bd69cb5ade..6f803609e498 100644 --- a/tools/lib/lockdep/preload.c +++ b/tools/lib/lockdep/preload.c | |||
@@ -92,7 +92,7 @@ enum { none, prepare, done, } __init_state; | |||
92 | static void init_preload(void); | 92 | static void init_preload(void); |
93 | static void try_init_preload(void) | 93 | static void try_init_preload(void) |
94 | { | 94 | { |
95 | if (!__init_state != done) | 95 | if (__init_state != done) |
96 | init_preload(); | 96 | init_preload(); |
97 | } | 97 | } |
98 | 98 | ||
@@ -252,7 +252,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex) | |||
252 | 252 | ||
253 | try_init_preload(); | 253 | try_init_preload(); |
254 | 254 | ||
255 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 0, 0, 2, NULL, | 255 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 0, 0, 1, NULL, |
256 | (unsigned long)_RET_IP_); | 256 | (unsigned long)_RET_IP_); |
257 | /* | 257 | /* |
258 | * Here's the thing with pthread mutexes: unlike the kernel variant, | 258 | * Here's the thing with pthread mutexes: unlike the kernel variant, |
@@ -281,7 +281,7 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex) | |||
281 | 281 | ||
282 | try_init_preload(); | 282 | try_init_preload(); |
283 | 283 | ||
284 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 1, 0, 2, NULL, (unsigned long)_RET_IP_); | 284 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 1, 0, 1, NULL, (unsigned long)_RET_IP_); |
285 | r = ll_pthread_mutex_trylock(mutex); | 285 | r = ll_pthread_mutex_trylock(mutex); |
286 | if (r) | 286 | if (r) |
287 | lock_release(&__get_lock(mutex)->dep_map, 0, (unsigned long)_RET_IP_); | 287 | lock_release(&__get_lock(mutex)->dep_map, 0, (unsigned long)_RET_IP_); |
@@ -303,7 +303,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex) | |||
303 | */ | 303 | */ |
304 | r = ll_pthread_mutex_unlock(mutex); | 304 | r = ll_pthread_mutex_unlock(mutex); |
305 | if (r) | 305 | if (r) |
306 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 306 | lock_acquire(&__get_lock(mutex)->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
307 | 307 | ||
308 | return r; | 308 | return r; |
309 | } | 309 | } |
@@ -352,7 +352,7 @@ int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) | |||
352 | 352 | ||
353 | init_preload(); | 353 | init_preload(); |
354 | 354 | ||
355 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 2, 2, NULL, (unsigned long)_RET_IP_); | 355 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 2, 1, NULL, (unsigned long)_RET_IP_); |
356 | r = ll_pthread_rwlock_rdlock(rwlock); | 356 | r = ll_pthread_rwlock_rdlock(rwlock); |
357 | if (r) | 357 | if (r) |
358 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 358 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
@@ -366,7 +366,7 @@ int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) | |||
366 | 366 | ||
367 | init_preload(); | 367 | init_preload(); |
368 | 368 | ||
369 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 1, 2, 2, NULL, (unsigned long)_RET_IP_); | 369 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 1, 2, 1, NULL, (unsigned long)_RET_IP_); |
370 | r = ll_pthread_rwlock_tryrdlock(rwlock); | 370 | r = ll_pthread_rwlock_tryrdlock(rwlock); |
371 | if (r) | 371 | if (r) |
372 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 372 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
@@ -380,7 +380,7 @@ int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) | |||
380 | 380 | ||
381 | init_preload(); | 381 | init_preload(); |
382 | 382 | ||
383 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 1, 0, 2, NULL, (unsigned long)_RET_IP_); | 383 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 1, 0, 1, NULL, (unsigned long)_RET_IP_); |
384 | r = ll_pthread_rwlock_trywrlock(rwlock); | 384 | r = ll_pthread_rwlock_trywrlock(rwlock); |
385 | if (r) | 385 | if (r) |
386 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 386 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
@@ -394,7 +394,7 @@ int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) | |||
394 | 394 | ||
395 | init_preload(); | 395 | init_preload(); |
396 | 396 | ||
397 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 397 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
398 | r = ll_pthread_rwlock_wrlock(rwlock); | 398 | r = ll_pthread_rwlock_wrlock(rwlock); |
399 | if (r) | 399 | if (r) |
400 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 400 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
@@ -411,7 +411,7 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock) | |||
411 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); | 411 | lock_release(&__get_lock(rwlock)->dep_map, 0, (unsigned long)_RET_IP_); |
412 | r = ll_pthread_rwlock_unlock(rwlock); | 412 | r = ll_pthread_rwlock_unlock(rwlock); |
413 | if (r) | 413 | if (r) |
414 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 0, 2, NULL, (unsigned long)_RET_IP_); | 414 | lock_acquire(&__get_lock(rwlock)->dep_map, 0, 0, 0, 1, NULL, (unsigned long)_RET_IP_); |
415 | 415 | ||
416 | return r; | 416 | return r; |
417 | } | 417 | } |
@@ -439,8 +439,6 @@ __attribute__((constructor)) static void init_preload(void) | |||
439 | ll_pthread_rwlock_unlock = dlsym(RTLD_NEXT, "pthread_rwlock_unlock"); | 439 | ll_pthread_rwlock_unlock = dlsym(RTLD_NEXT, "pthread_rwlock_unlock"); |
440 | #endif | 440 | #endif |
441 | 441 | ||
442 | printf("%p\n", ll_pthread_mutex_trylock);fflush(stdout); | ||
443 | |||
444 | lockdep_init(); | 442 | lockdep_init(); |
445 | 443 | ||
446 | __init_state = done; | 444 | __init_state = done; |