diff options
author | Andrii Nakryiko <andriin@fb.com> | 2020-02-29 15:11:10 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-03-02 16:25:14 -0800 |
commit | fd56e0058412fb542db0e9556f425747cf3f8366 (patch) | |
tree | fa11ac72a2bc294ab41dad229bb3142ef5996083 /tools/lib/bpf | |
parent | ca7dc2791b507f842d73e46b1a0453b36b69ffc2 (diff) | |
download | linux-fd56e0058412fb542db0e9556f425747cf3f8366.tar.bz2 |
libbpf: Fix use of PT_REGS_PARM macros with vmlinux.h
Add detection of vmlinux.h to bpf_tracing.h header for PT_REGS macro.
Currently, BPF applications have to define __KERNEL__ symbol to use correct
definition of struct pt_regs on x86 arch. This is due to different field names
under internal kernel vs UAPI conditions. To make this more transparent for
users, detect vmlinux.h by checking __VMLINUX_H__ symbol.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200229231112.1240137-3-andriin@fb.com
Diffstat (limited to 'tools/lib/bpf')
-rw-r--r-- | tools/lib/bpf/bpf_tracing.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h index b0dafe8b4ebc..8376f22b0e36 100644 --- a/tools/lib/bpf/bpf_tracing.h +++ b/tools/lib/bpf/bpf_tracing.h @@ -49,7 +49,7 @@ #if defined(bpf_target_x86) -#ifdef __KERNEL__ +#if defined(__KERNEL__) || defined(__VMLINUX_H__) #define PT_REGS_PARM1(x) ((x)->di) #define PT_REGS_PARM2(x) ((x)->si) #define PT_REGS_PARM3(x) ((x)->dx) |