File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -41,3 +41,35 @@ demo依赖demo_user
4141
4242- demo_kern.c中的文件是被编译成eBPF的二进制文件,是要被eBPF虚拟机执行的代码
4343- demo_user.c是将eBPF二进制文件加载到内核的代码
44+
45+
46+ ## 使用内核中的samples(commit bpf: add sample usages for persistent maps/progs)
47+
48+ 先要挂载对应的文件系统
49+
50+ mount -t bpf bpf /sys/fs/bpf
51+
52+ create map and insert elm
53+
54+ ./fds_example -F /sys/fs/bpf/m -P -m -k 1 -v 42
55+ bpf: map fd:3 (Success)
56+ bpf: pin ret:(0,Success)
57+ bpf: fd:3 u->(1:42) ret:(0,Success)
58+
59+ get elm
60+
61+ ./fds_example -F /sys/fs/bpf/m -G -m -k 1
62+ bpf: get fd:3 (Success)
63+ bpf: fd:3 l->(1):42 ret:(0,Success)
64+
65+ update elm
66+
67+ ./fds_example -F /sys/fs/bpf/m -G -m -k 1 -v 24
68+ bpf: get fd:3 (Success)
69+ bpf: fd:3 u->(1:24) ret:(0,Success)
70+
71+ get elm
72+
73+ ./fds_example -F /sys/fs/bpf/m -G -m -k 1
74+ bpf: get fd:3 (Success)
75+ bpf: fd:3 l->(1):24 ret:(0,Success)
You can’t perform that action at this time.
0 commit comments