Loading...
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>
8
9static __thread struct task_struct current_obj;
10
11/* lockdep wants these */
12bool debug_locks = true;
13bool debug_locks_silent;
14
15__attribute__((destructor)) static void liblockdep_exit(void)
16{
17 debug_check_no_locks_held();
18}
19
20struct task_struct *__curr(void)
21{
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);
26 }
27
28 return ¤t_obj;
29}
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>
7
8static __thread struct task_struct current_obj;
9
10/* lockdep wants these */
11bool debug_locks = true;
12bool debug_locks_silent;
13
14__attribute__((destructor)) static void liblockdep_exit(void)
15{
16 debug_check_no_locks_held();
17}
18
19struct task_struct *__curr(void)
20{
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);
25 }
26
27 return ¤t_obj;
28}