Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / tools / lib / lockdep / common.c
blob5c3b58cce8a9b911c7cac5f795bf402140b89ea5
1 // SPDX-License-Identifier: GPL-2.0
2 #include <stddef.h>
3 #include <stdbool.h>
4 #include <linux/compiler.h>
5 #include <linux/lockdep.h>
6 #include <unistd.h>
7 #include <sys/syscall.h>
9 static __thread struct task_struct current_obj;
11 /* lockdep wants these */
12 bool debug_locks = true;
13 bool debug_locks_silent;
15 __attribute__((destructor)) static void liblockdep_exit(void)
17 debug_check_no_locks_held();
20 struct task_struct *__curr(void)
22 if (current_obj.pid == 0) {
23 /* Makes lockdep output pretty */
24 prctl(PR_GET_NAME, current_obj.comm);
25 current_obj.pid = syscall(__NR_gettid);
28 return &current_obj;