Merge branch 'mixed-mode' into efi-for-mingo
[linux/fpc-iii.git] / tools / lib / lockdep / common.c
blob8ef602f18a32b9a19c7645488bd2bc8c757c30c6
1 #include <stddef.h>
2 #include <stdbool.h>
3 #include <linux/compiler.h>
4 #include <linux/lockdep.h>
5 #include <unistd.h>
6 #include <sys/syscall.h>
8 static __thread struct task_struct current_obj;
10 /* lockdep wants these */
11 bool debug_locks = true;
12 bool debug_locks_silent;
14 __attribute__((constructor)) static void liblockdep_init(void)
16 lockdep_init();
19 __attribute__((destructor)) static void liblockdep_exit(void)
21 debug_check_no_locks_held(&current_obj);
24 struct task_struct *__curr(void)
26 if (current_obj.pid == 0) {
27 /* Makes lockdep output pretty */
28 prctl(PR_GET_NAME, current_obj.comm);
29 current_obj.pid = syscall(__NR_gettid);
32 return &current_obj;