「以下是libbpf-bootstrap的一些主要特性:」
$ sudo apt-get install clang libelf1 libelf-dev zlib1g-dev
// 获取libbpf-bootstrap主仓的代码
$ git clone https://github.com/libbpf/libbpf-bootstrap
// 获取依赖的子仓代码
$ git submodule update --init --recursive
$ cd examples/c/
$ make
MKDIR .output
MKDIR .output/libbpf
LIB libbpf.a
MKDIR /home/rice/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs
CC /home/rice/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/bpf.o
CC /home/rice/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/btf.o
CC /home/rice/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/libbpf.o
CC /home/rice/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/libbpf_errno.o
CC /home/rice/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/netlink.o
CC /home/rice/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/nlattr.o
.....
BINARY usdt
BPF .output/sockfilter.bpf.o
GEN-SKEL .output/sockfilter.skel.h
CC .output/sockfilter.o
BINARY sockfilter
BPF .output/tc.bpf.o
GEN-SKEL .output/tc.skel.h
CC .output/tc.o
BINARY tc
BPF .output/ksyscall.bpf.o
GEN-SKEL .output/ksyscall.skel.h
CC .output/ksyscall.o
BINARY ksyscall
$
$ sudo ./kprobe
$ cat /sys/kernel/tracing/trace_pipe
$ touch youyeetoo
$ rm -rf youyeetoo
本文分享自 Rice 嵌入式开发技术分享 微信公众号,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!