Ai
4 Star 42 Fork 23

云微/bpf-developer-tutorial

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
opensnoop.bpf.c 556 Bytes
一键复制 编辑 原始数据 按行查看 历史
ocfox 提交于 2023-03-09 11:36 +08:00 . feat: deploy static web with mdbook (#11)
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
/// @description "Process ID to trace"
const volatile int pid_target = 0;
SEC("tracepoint/syscalls/sys_enter_openat")
int tracepoint__syscalls__sys_enter_openat(struct trace_event_raw_sys_enter* ctx)
{
u64 id = bpf_get_current_pid_tgid();
u32 pid = id;
if (pid_target && pid_target != pid)
return false;
// Use bpf_printk to print the process information
bpf_printk("Process ID: %d enter sys openat\n", pid);
return 0;
}
/// "Trace open family syscalls."
char LICENSE[] SEC("license") = "GPL";
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yunwei37/bpf-developer-tutorial.git
git@gitee.com:yunwei37/bpf-developer-tutorial.git
yunwei37
bpf-developer-tutorial
bpf-developer-tutorial
main

搜索帮助