diff options
author | Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> | 2019-08-15 15:13:56 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-08-21 14:31:38 +0200 |
commit | bb4b5c08a8e0f854a313184498b22fa37dd087db (patch) | |
tree | e61180ca51498f2d106aa490fddd31f9af22f273 /samples/bpf/tracex5_kern.c | |
parent | 624676e788992e4da8de1fad93bfe51563a7f9a0 (diff) | |
download | linux-next-bb4b5c08a8e0f854a313184498b22fa37dd087db.tar.gz |
samples: bpf: syscall_nrs: use mmap2 if defined
For arm32 xdp sockets mmap2 is preferred, so use it if it's defined.
Declaration of __NR_mmap can be skipped and it breaks build.
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'samples/bpf/tracex5_kern.c')
-rw-r--r-- | samples/bpf/tracex5_kern.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/samples/bpf/tracex5_kern.c b/samples/bpf/tracex5_kern.c index f57f4e1ea1ec..35cb0eed3be5 100644 --- a/samples/bpf/tracex5_kern.c +++ b/samples/bpf/tracex5_kern.c @@ -68,12 +68,25 @@ PROG(SYS__NR_read)(struct pt_regs *ctx) return 0; } +#ifdef __NR_mmap2 +PROG(SYS__NR_mmap2)(struct pt_regs *ctx) +{ + char fmt[] = "mmap2\n"; + + bpf_trace_printk(fmt, sizeof(fmt)); + return 0; +} +#endif + +#ifdef __NR_mmap PROG(SYS__NR_mmap)(struct pt_regs *ctx) { char fmt[] = "mmap\n"; + bpf_trace_printk(fmt, sizeof(fmt)); return 0; } +#endif char _license[] SEC("license") = "GPL"; u32 _version SEC("version") = LINUX_VERSION_CODE; |