add bootstrap files

This commit is contained in:
yunwei37
2023-05-07 01:25:01 +08:00
parent c6c180293f
commit fc1301094e
9 changed files with 479 additions and 134 deletions

View File

@@ -151,6 +151,22 @@ int handle_exit(struct trace_event_raw_sched_process_template* ctx)
最后主函数调用bpf_ringbuf_poll来轮询BPF ringbuf并在接收到新的事件时处理该事件。这个函数会持续运行直到全局标志exiting被设置为true此时它会清理资源并退出。
## Install Dependencies
You will need `clang`, `libelf` and `zlib` to build the examples, package names may vary across distros.
On Ubuntu/Debian, you need:
```shell
$ apt install clang libelf1 libelf-dev zlib1g-dev
```
On CentOS/Fedora, you need:
```shell
$ dnf install clang elfutils-libelf elfutils-libelf-devel zlib-devel
```
## 编译运行
编译运行上述代码:
@@ -162,7 +178,6 @@ $ sudo ecli run package.json
Runing eBPF program...
```
## 总结
这是一个使用BPF的C程序用于跟踪进程的启动和退出事件并显示有关这些事件的信息。它通过使用argp API来解析命令行参数并使用BPF地图存储进程的信息包括进程的PID和执行文件的文件名。程序还使用了SEC函数来附加BPF程序以监视进程的执行和退出事件。最后程序在终端中打印出启动和退出的进程信息。