swh:1:snp:c2847dfd741eae21606027cf29250d1ebcd63fb4
Raw File
Tip revision: 694d0d0bb2030d2e36df73e2d23d5770511dbc8d authored by Linus Torvalds on 15 August 2016, 02:11:36 UTC
Linux 4.8-rc2
Tip revision: 694d0d0
common.c
#include <stddef.h>
#include <stdbool.h>
#include <linux/compiler.h>
#include <linux/lockdep.h>
#include <unistd.h>
#include <sys/syscall.h>

static __thread struct task_struct current_obj;

/* lockdep wants these */
bool debug_locks = true;
bool debug_locks_silent;

__attribute__((destructor)) static void liblockdep_exit(void)
{
	debug_check_no_locks_held();
}

struct task_struct *__curr(void)
{
	if (current_obj.pid == 0) {
		/* Makes lockdep output pretty */
		prctl(PR_GET_NAME, current_obj.comm);
		current_obj.pid = syscall(__NR_gettid);
	}

	return &current_obj;
}
back to top