mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 00:00:52 +07:00
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>
This commit is contained in:
parent
624676e788
commit
bb4b5c08a8
@ -9,5 +9,11 @@ void syscall_defines(void)
|
||||
COMMENT("Linux system call numbers.");
|
||||
SYSNR(__NR_write);
|
||||
SYSNR(__NR_read);
|
||||
#ifdef __NR_mmap2
|
||||
SYSNR(__NR_mmap2);
|
||||
#endif
|
||||
#ifdef __NR_mmap
|
||||
SYSNR(__NR_mmap);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -68,12 +68,25 @@ PROG(SYS__NR_read)(struct pt_regs *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PROG(SYS__NR_mmap)(struct pt_regs *ctx)
|
||||
#ifdef __NR_mmap2
|
||||
PROG(SYS__NR_mmap2)(struct pt_regs *ctx)
|
||||
{
|
||||
char fmt[] = "mmap\n";
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user