Difference between revisions of "EBPF"

From Wiki 4 Men
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
https://www.srodi.com/posts/how-to-write-and-run-an-ebpf-program-on-linux/
 
   
https://www.wwt.com/blog/ebpf-is-the-bees-knees-for-enterprise-environments
 
 
https://medium.com/@megawan/writing-compiling-and-loading-ebpf-program-7b0efa014142
 
   
 
== Prepare ==
 
== Prepare ==
Line 23: Line 19:
   
 
bpftool prog load trace_file_delete.o /sys/fs/bpf/trace_file_delete
 
bpftool prog load trace_file_delete.o /sys/fs/bpf/trace_file_delete
  +
  +
== List ==
  +
  +
bpftool prog list
   
 
== Unload ==
 
== Unload ==
Line 29: Line 29:
   
 
== External Links ==
 
== External Links ==
  +
 
*[https://www.srodi.com/posts/how-to-write-and-run-an-ebpf-program-on-linux/ Sropi]
 
*[https://www.wwt.com/blog/ebpf-is-the-bees-knees-for-enterprise-environments WWT]
 
*[https://medium.com/@megawan/writing-compiling-and-loading-ebpf-program-7b0efa014142 Medium]
   
 
{{Draft}}
 
{{Draft}}

Latest revision as of 12:50, 29 June 2025


Prepare

Might be needed:

sudo ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm

sudo apt install bpftool clang llvm libbpf-dev

bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h

Compile

clang -O2 -g -target bpf -c trace_file_delete.c -o trace_file_delete.o


Load

bpftool prog load trace_file_delete.o /sys/fs/bpf/trace_file_delete

List

bpftool prog list

Unload

rm /sys/fs/bpf/trace_file_delete

External Links


This is a draft article and so will not be published on A Voice for Men or appear in random article selections. Wiki4Men is looking for trustworthy editors that can turn draft articles in to featured articles. Information on how to apply is on the Main Page.

Technical articles in this category are applicable to Linux. Debian GNU/Linux is used in examples. Much of the information is also applicable to other Linux distributions and Unix flavours.