diff options
| author | Hengqi Chen <[email protected]> | 2022-02-07 14:31:33 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2022-02-09 05:45:02 +0000 |
| commit | 816ae109554756ce5e22e3aabde10161c4d0a4f7 (patch) | |
| tree | 09215447fd16ddd4375d741116f8ca26aad4b332 /net/switchdev/switchdev.c | |
| parent | Merge branch 'Fix accessing syscall arguments' (diff) | |
| download | kernel-816ae109554756ce5e22e3aabde10161c4d0a4f7.tar.gz kernel-816ae109554756ce5e22e3aabde10161c4d0a4f7.zip | |
libbpf: Add BPF_KPROBE_SYSCALL macro
Add syscall-specific variant of BPF_KPROBE named BPF_KPROBE_SYSCALL ([0]).
The new macro hides the underlying way of getting syscall input arguments.
With the new macro, the following code:
SEC("kprobe/__x64_sys_close")
int BPF_KPROBE(do_sys_close, struct pt_regs *regs)
{
int fd;
fd = PT_REGS_PARM1_CORE(regs);
/* do something with fd */
}
can be written as:
SEC("kprobe/__x64_sys_close")
int BPF_KPROBE_SYSCALL(do_sys_close, int fd)
{
/* do something with fd */
}
[0] Closes: https://github.com/libbpf/libbpf/issues/425
Signed-off-by: Hengqi Chen <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'net/switchdev/switchdev.c')
0 files changed, 0 insertions, 0 deletions
