mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Organize source files
This commit is contained in:
15
examples/c-form/Makefile
Normal file
15
examples/c-form/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
BPF_CLANG := clang
|
||||
CFLAGS := -O2 -emit-llvm -target bpf -c
|
||||
|
||||
SRC := example.bpf.c
|
||||
OUT := example.bpf.ll
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(OUT)
|
||||
|
||||
$(OUT): $(SRC)
|
||||
$(BPF_CLANG) $(CFLAGS) -S $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OUT)
|
||||
11
examples/c-form/example.bpf.c
Normal file
11
examples/c-form/example.bpf.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <linux/bpf.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
|
||||
SEC("tracepoint/syscalls/sys_enter_execve")
|
||||
int trace_execve(void *ctx)
|
||||
{
|
||||
bpf_printk("execve called\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
char LICENSE[] SEC("license") = "GPL";
|
||||
Reference in New Issue
Block a user