mirror of
https://github.com/h3xduck/TripleCross.git
synced 2025-12-23 09:53:08 +08:00
Setup development environment with libbpf
This commit is contained in:
22
external/libbpf-bootstrap/examples/c/uprobe.bpf.c
vendored
Normal file
22
external/libbpf-bootstrap/examples/c/uprobe.bpf.c
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
/* Copyright (c) 2020 Facebook */
|
||||
#include <linux/bpf.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
|
||||
char LICENSE[] SEC("license") = "Dual BSD/GPL";
|
||||
|
||||
SEC("uprobe/func")
|
||||
int BPF_KPROBE(uprobe, int a, int b)
|
||||
{
|
||||
bpf_printk("UPROBE ENTRY: a = %d, b = %d\n", a, b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SEC("uretprobe/func")
|
||||
int BPF_KRETPROBE(uretprobe, int ret)
|
||||
{
|
||||
bpf_printk("UPROBE EXIT: return = %d\n", ret);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user