diff options
| author | Levin, Alexander (Sasha Levin) <alexander.levin@verizon.com> | 2017-05-30 20:38:09 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-06-05 03:28:14 -0400 |
| commit | e58e871becec2d3b04ed91c0c16fe8deac9c9dfa (patch) | |
| tree | 0d5423db3f5db43609e25a19008b7c4451c0ce1a /tools/include/linux | |
| parent | 4ea4b3c25752499a67c4a35cafd2d5535017faad (diff) | |
tools/lib/lockdep: Remove private kernel headers
Move to using tools/include/ instead.
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@redhat.com
Link: http://lkml.kernel.org/r/20170531003747.10557-2-alexander.levin@verizon.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/include/linux')
| -rw-r--r-- | tools/include/linux/compiler.h | 12 | ||||
| -rw-r--r-- | tools/include/linux/debug_locks.h | 13 | ||||
| -rw-r--r-- | tools/include/linux/delay.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/ftrace.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/gfp.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/hardirq.h | 11 | ||||
| -rw-r--r-- | tools/include/linux/interrupt.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/irqflags.h | 38 | ||||
| -rw-r--r-- | tools/include/linux/kallsyms.h | 33 | ||||
| -rw-r--r-- | tools/include/linux/kern_levels.h | 25 | ||||
| -rw-r--r-- | tools/include/linux/kernel.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/kmemcheck.h | 8 | ||||
| -rw-r--r-- | tools/include/linux/linkage.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/lockdep.h | 67 | ||||
| -rw-r--r-- | tools/include/linux/module.h | 11 | ||||
| -rw-r--r-- | tools/include/linux/mutex.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/proc_fs.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/rcu.h | 24 | ||||
| -rw-r--r-- | tools/include/linux/sched/clock.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/sched/task.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/seq_file.h | 4 | ||||
| -rw-r--r-- | tools/include/linux/spinlock.h | 26 | ||||
| -rw-r--r-- | tools/include/linux/stacktrace.h | 32 |
23 files changed, 344 insertions, 0 deletions
diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h index 23299d7e7160..ef6ab908a42f 100644 --- a/tools/include/linux/compiler.h +++ b/tools/include/linux/compiler.h | |||
| @@ -45,6 +45,10 @@ | |||
| 45 | # define __maybe_unused __attribute__((unused)) | 45 | # define __maybe_unused __attribute__((unused)) |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | #ifndef __used | ||
| 49 | # define __used __attribute__((__unused__)) | ||
| 50 | #endif | ||
| 51 | |||
| 48 | #ifndef __packed | 52 | #ifndef __packed |
| 49 | # define __packed __attribute__((__packed__)) | 53 | # define __packed __attribute__((__packed__)) |
| 50 | #endif | 54 | #endif |
| @@ -65,6 +69,14 @@ | |||
| 65 | # define unlikely(x) __builtin_expect(!!(x), 0) | 69 | # define unlikely(x) __builtin_expect(!!(x), 0) |
| 66 | #endif | 70 | #endif |
| 67 | 71 | ||
| 72 | #ifndef __init | ||
| 73 | # define __init | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #ifndef noinline | ||
| 77 | # define noinline | ||
| 78 | #endif | ||
| 79 | |||
| 68 | #define uninitialized_var(x) x = *(&(x)) | 80 | #define uninitialized_var(x) x = *(&(x)) |
| 69 | 81 | ||
| 70 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | 82 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) |
diff --git a/tools/include/linux/debug_locks.h b/tools/include/linux/debug_locks.h new file mode 100644 index 000000000000..61cc7f501168 --- /dev/null +++ b/tools/include/linux/debug_locks.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #ifndef _LIBLOCKDEP_DEBUG_LOCKS_H_ | ||
| 2 | #define _LIBLOCKDEP_DEBUG_LOCKS_H_ | ||
| 3 | |||
| 4 | #include <stddef.h> | ||
| 5 | #include <linux/compiler.h> | ||
| 6 | #include <asm/bug.h> | ||
| 7 | |||
| 8 | #define DEBUG_LOCKS_WARN_ON(x) WARN_ON(x) | ||
| 9 | |||
| 10 | extern bool debug_locks; | ||
| 11 | extern bool debug_locks_silent; | ||
| 12 | |||
| 13 | #endif | ||
diff --git a/tools/include/linux/delay.h b/tools/include/linux/delay.h new file mode 100644 index 000000000000..55aa4173af1f --- /dev/null +++ b/tools/include/linux/delay.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_INCLUDE_LINUX_DELAY_H | ||
| 2 | #define _TOOLS_INCLUDE_LINUX_DELAY_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_INCLUDE_LINUX_DELAY_H */ | ||
diff --git a/tools/include/linux/ftrace.h b/tools/include/linux/ftrace.h new file mode 100644 index 000000000000..949f541ce11e --- /dev/null +++ b/tools/include/linux/ftrace.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_INCLUDE_LINUX_FTRACE_H | ||
| 2 | #define _TOOLS_INCLUDE_LINUX_FTRACE_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_INCLUDE_LINUX_FTRACE_H */ | ||
diff --git a/tools/include/linux/gfp.h b/tools/include/linux/gfp.h new file mode 100644 index 000000000000..22030756fbc0 --- /dev/null +++ b/tools/include/linux/gfp.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_INCLUDE_LINUX_GFP_H | ||
| 2 | #define _TOOLS_INCLUDE_LINUX_GFP_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_INCLUDE_LINUX_GFP_H */ | ||
diff --git a/tools/include/linux/hardirq.h b/tools/include/linux/hardirq.h new file mode 100644 index 000000000000..c8f3f8f58729 --- /dev/null +++ b/tools/include/linux/hardirq.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #ifndef _LIBLOCKDEP_LINUX_HARDIRQ_H_ | ||
| 2 | #define _LIBLOCKDEP_LINUX_HARDIRQ_H_ | ||
| 3 | |||
| 4 | #define SOFTIRQ_BITS 0UL | ||
| 5 | #define HARDIRQ_BITS 0UL | ||
| 6 | #define SOFTIRQ_SHIFT 0UL | ||
| 7 | #define HARDIRQ_SHIFT 0UL | ||
| 8 | #define hardirq_count() 0UL | ||
| 9 | #define softirq_count() 0UL | ||
| 10 | |||
| 11 | #endif | ||
diff --git a/tools/include/linux/interrupt.h b/tools/include/linux/interrupt.h new file mode 100644 index 000000000000..6be25bbdca9e --- /dev/null +++ b/tools/include/linux/interrupt.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_INCLUDE_LINUX_INTERRUPT_H | ||
| 2 | #define _TOOLS_INCLUDE_LINUX_INTERRUPT_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_INCLUDE_LINUX_INTERRUPT_H */ | ||
diff --git a/tools/include/linux/irqflags.h b/tools/include/linux/irqflags.h new file mode 100644 index 000000000000..df77669cfe1c --- /dev/null +++ b/tools/include/linux/irqflags.h | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #ifndef _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_ | ||
| 2 | #define _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_ | ||
| 3 | |||
| 4 | # define trace_hardirq_context(p) 0 | ||
| 5 | # define trace_softirq_context(p) 0 | ||
| 6 | # define trace_hardirqs_enabled(p) 0 | ||
| 7 | # define trace_softirqs_enabled(p) 0 | ||
| 8 | # define trace_hardirq_enter() do { } while (0) | ||
| 9 | # define trace_hardirq_exit() do { } while (0) | ||
| 10 | # define lockdep_softirq_enter() do { } while (0) | ||
| 11 | # define lockdep_softirq_exit() do { } while (0) | ||
| 12 | # define INIT_TRACE_IRQFLAGS | ||
| 13 | |||
| 14 | # define stop_critical_timings() do { } while (0) | ||
| 15 | # define start_critical_timings() do { } while (0) | ||
| 16 | |||
| 17 | #define raw_local_irq_disable() do { } while (0) | ||
| 18 | #define raw_local_irq_enable() do { } while (0) | ||
| 19 | #define raw_local_irq_save(flags) ((flags) = 0) | ||
| 20 | #define raw_local_irq_restore(flags) ((void)(flags)) | ||
| 21 | #define raw_local_save_flags(flags) ((flags) = 0) | ||
| 22 | #define raw_irqs_disabled_flags(flags) ((void)(flags)) | ||
| 23 | #define raw_irqs_disabled() 0 | ||
| 24 | #define raw_safe_halt() | ||
| 25 | |||
| 26 | #define local_irq_enable() do { } while (0) | ||
| 27 | #define local_irq_disable() do { } while (0) | ||
| 28 | #define local_irq_save(flags) ((flags) = 0) | ||
| 29 | #define local_irq_restore(flags) ((void)(flags)) | ||
| 30 | #define local_save_flags(flags) ((flags) = 0) | ||
| 31 | #define irqs_disabled() (1) | ||
| 32 | #define irqs_disabled_flags(flags) ((void)(flags), 0) | ||
| 33 | #define safe_halt() do { } while (0) | ||
| 34 | |||
| 35 | #define trace_lock_release(x, y) | ||
| 36 | #define trace_lock_acquire(a, b, c, d, e, f, g) | ||
| 37 | |||
| 38 | #endif | ||
diff --git a/tools/include/linux/kallsyms.h b/tools/include/linux/kallsyms.h new file mode 100644 index 000000000000..582cc1e5f3a4 --- /dev/null +++ b/tools/include/linux/kallsyms.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #ifndef _LIBLOCKDEP_LINUX_KALLSYMS_H_ | ||
| 2 | #define _LIBLOCKDEP_LINUX_KALLSYMS_H_ | ||
| 3 | |||
| 4 | #include <linux/kernel.h> | ||
| 5 | #include <stdio.h> | ||
| 6 | #include <unistd.h> | ||
| 7 | |||
| 8 | #define KSYM_NAME_LEN 128 | ||
| 9 | |||
| 10 | struct module; | ||
| 11 | |||
| 12 | static inline const char *kallsyms_lookup(unsigned long addr, | ||
| 13 | unsigned long *symbolsize, | ||
| 14 | unsigned long *offset, | ||
| 15 | char **modname, char *namebuf) | ||
| 16 | { | ||
| 17 | return NULL; | ||
| 18 | } | ||
| 19 | |||
| 20 | #include <execinfo.h> | ||
| 21 | #include <stdlib.h> | ||
| 22 | static inline void print_ip_sym(unsigned long ip) | ||
| 23 | { | ||
| 24 | char **name; | ||
| 25 | |||
| 26 | name = backtrace_symbols((void **)&ip, 1); | ||
| 27 | |||
| 28 | dprintf(STDOUT_FILENO, "%s\n", *name); | ||
| 29 | |||
| 30 | free(name); | ||
| 31 | } | ||
| 32 | |||
| 33 | #endif | ||
diff --git a/tools/include/linux/kern_levels.h b/tools/include/linux/kern_levels.h new file mode 100644 index 000000000000..3b9bade28698 --- /dev/null +++ b/tools/include/linux/kern_levels.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef __KERN_LEVELS_H__ | ||
| 2 | #define __KERN_LEVELS_H__ | ||
| 3 | |||
| 4 | #define KERN_SOH "" /* ASCII Start Of Header */ | ||
| 5 | #define KERN_SOH_ASCII '' | ||
| 6 | |||
| 7 | #define KERN_EMERG KERN_SOH "" /* system is unusable */ | ||
| 8 | #define KERN_ALERT KERN_SOH "" /* action must be taken immediately */ | ||
| 9 | #define KERN_CRIT KERN_SOH "" /* critical conditions */ | ||
| 10 | #define KERN_ERR KERN_SOH "" /* error conditions */ | ||
| 11 | #define KERN_WARNING KERN_SOH "" /* warning conditions */ | ||
| 12 | #define KERN_NOTICE KERN_SOH "" /* normal but significant condition */ | ||
| 13 | #define KERN_INFO KERN_SOH "" /* informational */ | ||
| 14 | #define KERN_DEBUG KERN_SOH "" /* debug-level messages */ | ||
| 15 | |||
| 16 | #define KERN_DEFAULT KERN_SOH "" /* the default kernel loglevel */ | ||
| 17 | |||
| 18 | /* | ||
| 19 | * Annotation for a "continued" line of log printout (only done after a | ||
| 20 | * line that had no enclosing \n). Only to be used by core/arch code | ||
| 21 | * during early bootup (a continued line is not SMP-safe otherwise). | ||
| 22 | */ | ||
| 23 | #define KERN_CONT "" | ||
| 24 | |||
| 25 | #endif | ||
diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h index 73ccc48126bb..801b927499f2 100644 --- a/tools/include/linux/kernel.h +++ b/tools/include/linux/kernel.h | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | (type *)((char *)__mptr - offsetof(type, member)); }) | 32 | (type *)((char *)__mptr - offsetof(type, member)); }) |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | ||
| 35 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | 36 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) |
| 36 | 37 | ||
| 37 | #ifndef max | 38 | #ifndef max |
| @@ -89,4 +90,7 @@ int scnprintf(char * buf, size_t size, const char * fmt, ...); | |||
| 89 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | 90 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) |
| 90 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | 91 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) |
| 91 | 92 | ||
| 93 | #define current_gfp_context(k) 0 | ||
| 94 | #define synchronize_sched() | ||
| 95 | |||
| 92 | #endif | 96 | #endif |
diff --git a/tools/include/linux/kmemcheck.h b/tools/include/linux/kmemcheck.h new file mode 100644 index 000000000000..94d598bc6abe --- /dev/null +++ b/tools/include/linux/kmemcheck.h | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #ifndef _LIBLOCKDEP_LINUX_KMEMCHECK_H_ | ||
| 2 | #define _LIBLOCKDEP_LINUX_KMEMCHECK_H_ | ||
| 3 | |||
| 4 | static inline void kmemcheck_mark_initialized(void *address, unsigned int n) | ||
| 5 | { | ||
| 6 | } | ||
| 7 | |||
| 8 | #endif | ||
diff --git a/tools/include/linux/linkage.h b/tools/include/linux/linkage.h new file mode 100644 index 000000000000..bc763d500262 --- /dev/null +++ b/tools/include/linux/linkage.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_INCLUDE_LINUX_LINKAGE_H | ||
| 2 | #define _TOOLS_INCLUDE_LINUX_LINKAGE_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_INCLUDE_LINUX_LINKAGE_H */ | ||
diff --git a/tools/include/linux/lockdep.h b/tools/include/linux/lockdep.h new file mode 100644 index 000000000000..8da3e8effafa --- /dev/null +++ b/tools/include/linux/lockdep.h | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | #ifndef _LIBLOCKDEP_LOCKDEP_H_ | ||
| 2 | #define _LIBLOCKDEP_LOCKDEP_H_ | ||
| 3 | |||
| 4 | #include <sys/prctl.h> | ||
| 5 | #include <sys/syscall.h> | ||
| 6 | #include <string.h> | ||
| 7 | #include <limits.h> | ||
| 8 | #include <linux/utsname.h> | ||
| 9 | #include <linux/compiler.h> | ||
| 10 | #include <linux/export.h> | ||
| 11 | #include <linux/kern_levels.h> | ||
| 12 | #include <linux/err.h> | ||
| 13 | #include <linux/rcu.h> | ||
| 14 | #include <linux/list.h> | ||
| 15 | #include <linux/hardirq.h> | ||
| 16 | #include <unistd.h> | ||
| 17 | |||
| 18 | #define MAX_LOCK_DEPTH 63UL | ||
| 19 | |||
| 20 | #define asmlinkage | ||
| 21 | #define __visible | ||
| 22 | |||
| 23 | #include "../../../include/linux/lockdep.h" | ||
| 24 | |||
| 25 | struct task_struct { | ||
| 26 | u64 curr_chain_key; | ||
| 27 | int lockdep_depth; | ||
| 28 | unsigned int lockdep_recursion; | ||
| 29 | struct held_lock held_locks[MAX_LOCK_DEPTH]; | ||
| 30 | gfp_t lockdep_reclaim_gfp; | ||
| 31 | int pid; | ||
| 32 | char comm[17]; | ||
| 33 | }; | ||
| 34 | |||
| 35 | extern struct task_struct *__curr(void); | ||
| 36 | |||
| 37 | #define current (__curr()) | ||
| 38 | |||
| 39 | static inline int debug_locks_off(void) | ||
| 40 | { | ||
| 41 | return 1; | ||
| 42 | } | ||
| 43 | |||
| 44 | #define task_pid_nr(tsk) ((tsk)->pid) | ||
| 45 | |||
| 46 | #define KSYM_NAME_LEN 128 | ||
| 47 | #define printk(...) dprintf(STDOUT_FILENO, __VA_ARGS__) | ||
| 48 | #define pr_err(format, ...) fprintf (stderr, format, ## __VA_ARGS__) | ||
| 49 | #define pr_warn pr_err | ||
| 50 | |||
| 51 | #define list_del_rcu list_del | ||
| 52 | |||
| 53 | #define atomic_t unsigned long | ||
| 54 | #define atomic_inc(x) ((*(x))++) | ||
| 55 | |||
| 56 | #define print_tainted() "" | ||
| 57 | #define static_obj(x) 1 | ||
| 58 | |||
| 59 | #define debug_show_all_locks() | ||
| 60 | extern void debug_check_no_locks_held(void); | ||
| 61 | |||
| 62 | static __used bool __is_kernel_percpu_address(unsigned long addr, void *can_addr) | ||
| 63 | { | ||
| 64 | return false; | ||
| 65 | } | ||
| 66 | |||
| 67 | #endif | ||
diff --git a/tools/include/linux/module.h b/tools/include/linux/module.h new file mode 100644 index 000000000000..07055db296f3 --- /dev/null +++ b/tools/include/linux/module.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #ifndef _LIBLOCKDEP_LINUX_MODULE_H_ | ||
| 2 | #define _LIBLOCKDEP_LINUX_MODULE_H_ | ||
| 3 | |||
| 4 | #define module_param(name, type, perm) | ||
| 5 | |||
| 6 | static inline bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr) | ||
| 7 | { | ||
| 8 | return false; | ||
| 9 | } | ||
| 10 | |||
| 11 | #endif | ||
diff --git a/tools/include/linux/mutex.h b/tools/include/linux/mutex.h new file mode 100644 index 000000000000..a8180d25f2fc --- /dev/null +++ b/tools/include/linux/mutex.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_INCLUDE_LINUX_MUTEX_H | ||
| 2 | #define _TOOLS_INCLUDE_LINUX_MUTEX_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_INCLUDE_LINUX_MUTEX_H */ | ||
diff --git a/tools/include/linux/proc_fs.h b/tools/include/linux/proc_fs.h new file mode 100644 index 000000000000..8b3b03b64fda --- /dev/null +++ b/tools/include/linux/proc_fs.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_INCLUDE_LINUX_PROC_FS_H | ||
| 2 | #define _TOOLS_INCLUDE_LINUX_PROC_FS_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_INCLUDE_LINUX_PROC_FS_H */ | ||
diff --git a/tools/include/linux/rcu.h b/tools/include/linux/rcu.h new file mode 100644 index 000000000000..5080649dad04 --- /dev/null +++ b/tools/include/linux/rcu.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #ifndef _LIBLOCKDEP_RCU_H_ | ||
| 2 | #define _LIBLOCKDEP_RCU_H_ | ||
| 3 | |||
| 4 | int rcu_scheduler_active; | ||
| 5 | |||
| 6 | static inline int rcu_lockdep_current_cpu_online(void) | ||
| 7 | { | ||
| 8 | return 1; | ||
| 9 | } | ||
| 10 | |||
| 11 | static inline int rcu_is_cpu_idle(void) | ||
| 12 | { | ||
| 13 | return 1; | ||
| 14 | } | ||
| 15 | |||
| 16 | static inline bool rcu_is_watching(void) | ||
| 17 | { | ||
| 18 | return false; | ||
| 19 | } | ||
| 20 | |||
| 21 | #define rcu_assign_pointer(p, v) ((p) = (v)) | ||
| 22 | #define RCU_INIT_POINTER(p, v) p=(v) | ||
| 23 | |||
| 24 | #endif | ||
diff --git a/tools/include/linux/sched/clock.h b/tools/include/linux/sched/clock.h new file mode 100644 index 000000000000..5837d17c4182 --- /dev/null +++ b/tools/include/linux/sched/clock.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_PERF_LINUX_SCHED_CLOCK_H | ||
| 2 | #define _TOOLS_PERF_LINUX_SCHED_CLOCK_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_PERF_LINUX_SCHED_CLOCK_H */ | ||
diff --git a/tools/include/linux/sched/task.h b/tools/include/linux/sched/task.h new file mode 100644 index 000000000000..a97890eca110 --- /dev/null +++ b/tools/include/linux/sched/task.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_PERF_LINUX_SCHED_TASK_H | ||
| 2 | #define _TOOLS_PERF_LINUX_SCHED_TASK_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_PERF_LINUX_SCHED_TASK_H */ | ||
diff --git a/tools/include/linux/seq_file.h b/tools/include/linux/seq_file.h new file mode 100644 index 000000000000..102fd9217f1f --- /dev/null +++ b/tools/include/linux/seq_file.h | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #ifndef _TOOLS_INCLUDE_LINUX_SEQ_FILE_H | ||
| 2 | #define _TOOLS_INCLUDE_LINUX_SEQ_FILE_H | ||
| 3 | |||
| 4 | #endif /* _TOOLS_INCLUDE_LINUX_SEQ_FILE_H */ | ||
diff --git a/tools/include/linux/spinlock.h b/tools/include/linux/spinlock.h index 58397dcb19d6..417cda4f793f 100644 --- a/tools/include/linux/spinlock.h +++ b/tools/include/linux/spinlock.h | |||
| @@ -1,5 +1,31 @@ | |||
| 1 | #ifndef __LINUX_SPINLOCK_H_ | ||
| 2 | #define __LINUX_SPINLOCK_H_ | ||
| 3 | |||
| 4 | #include <pthread.h> | ||
| 5 | #include <stdbool.h> | ||
| 6 | |||
| 1 | #define spinlock_t pthread_mutex_t | 7 | #define spinlock_t pthread_mutex_t |
| 2 | #define DEFINE_SPINLOCK(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER; | 8 | #define DEFINE_SPINLOCK(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER; |
| 3 | 9 | ||
| 4 | #define spin_lock_irqsave(x, f) (void)f, pthread_mutex_lock(x) | 10 | #define spin_lock_irqsave(x, f) (void)f, pthread_mutex_lock(x) |
| 5 | #define spin_unlock_irqrestore(x, f) (void)f, pthread_mutex_unlock(x) | 11 | #define spin_unlock_irqrestore(x, f) (void)f, pthread_mutex_unlock(x) |
| 12 | |||
| 13 | #define arch_spinlock_t pthread_mutex_t | ||
| 14 | #define __ARCH_SPIN_LOCK_UNLOCKED PTHREAD_MUTEX_INITIALIZER | ||
| 15 | |||
| 16 | static inline void arch_spin_lock(arch_spinlock_t *mutex) | ||
| 17 | { | ||
| 18 | pthread_mutex_lock(mutex); | ||
| 19 | } | ||
| 20 | |||
| 21 | static inline void arch_spin_unlock(arch_spinlock_t *mutex) | ||
| 22 | { | ||
| 23 | pthread_mutex_unlock(mutex); | ||
| 24 | } | ||
| 25 | |||
| 26 | static inline bool arch_spin_is_locked(arch_spinlock_t *mutex) | ||
| 27 | { | ||
| 28 | return true; | ||
| 29 | } | ||
| 30 | |||
| 31 | #endif | ||
diff --git a/tools/include/linux/stacktrace.h b/tools/include/linux/stacktrace.h new file mode 100644 index 000000000000..39aecc6b19d1 --- /dev/null +++ b/tools/include/linux/stacktrace.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | #ifndef _LIBLOCKDEP_LINUX_STACKTRACE_H_ | ||
| 2 | #define _LIBLOCKDEP_LINUX_STACKTRACE_H_ | ||
| 3 | |||
| 4 | #include <execinfo.h> | ||
| 5 | |||
| 6 | struct stack_trace { | ||
| 7 | unsigned int nr_entries, max_entries; | ||
| 8 | unsigned long *entries; | ||
| 9 | int skip; | ||
| 10 | }; | ||
| 11 | |||
| 12 | static inline void print_stack_trace(struct stack_trace *trace, int spaces) | ||
| 13 | { | ||
| 14 | backtrace_symbols_fd((void **)trace->entries, trace->nr_entries, 1); | ||
| 15 | } | ||
| 16 | |||
| 17 | #define save_stack_trace(trace) \ | ||
| 18 | ((trace)->nr_entries = \ | ||
| 19 | backtrace((void **)(trace)->entries, (trace)->max_entries)) | ||
| 20 | |||
| 21 | static inline int dump_stack(void) | ||
| 22 | { | ||
| 23 | void *array[64]; | ||
| 24 | size_t size; | ||
| 25 | |||
| 26 | size = backtrace(array, 64); | ||
| 27 | backtrace_symbols_fd(array, size, 1); | ||
| 28 | |||
| 29 | return 0; | ||
| 30 | } | ||
| 31 | |||
| 32 | #endif | ||
