Linux 4.11-rc6
[linux/fpc-iii.git] / tools / lib / lockdep / common.c
blobd1c89cc06f5f6710471c42dc5b2a475a54ee7658
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__((destructor)) static void liblockdep_exit(void)
16 debug_check_no_locks_held();
19 struct task_struct *__curr(void)
21 if (current_obj.pid == 0) {
22 /* Makes lockdep output pretty */
23 prctl(PR_GET_NAME, current_obj.comm);
24 current_obj.pid = syscall(__NR_gettid);
27 return &current_obj;