mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Get ex2 running
This commit is contained in:
@ -1,19 +1,19 @@
|
||||
BPF_CLANG := clang
|
||||
CFLAGS := -O2 -emit-llvm -target bpf -c
|
||||
|
||||
SRC := ex3.bpf.c
|
||||
OUT := ex3.bpf.ll
|
||||
OBJECT := ex3.bpf.o
|
||||
SRC := $(wildcard *.bpf.c)
|
||||
LL := $(SRC:.bpf.c=.bpf.ll)
|
||||
OBJ := $(SRC:.bpf.c=.bpf.o)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(OUT)
|
||||
|
||||
object: $(SRC)
|
||||
$(BPF_CLANG) -O2 -g -target bpf -c $< -o $(OBJECT)
|
||||
all: $(LL) $(OBJ)
|
||||
|
||||
$(OUT): $(SRC) object
|
||||
%.bpf.o: %.bpf.c
|
||||
$(BPF_CLANG) -O2 -target bpf -c $< -o $@
|
||||
|
||||
%.bpf.ll: %.bpf.c
|
||||
$(BPF_CLANG) $(CFLAGS) -S $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OUT) $(OBJECT)
|
||||
rm -f $(LL) $(OBJ)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include <linux/bpf.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
|
||||
SEC("kprobe/sys_clone")
|
||||
SEC("tracepoint/syscalls/sys_enter_execve")
|
||||
int hello(struct pt_regs *ctx) {
|
||||
bpf_printk("Hello, World!\n");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user