mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
add tests
This commit is contained in:
@ -1,15 +1,16 @@
|
||||
from vmlinux import struct_request, struct_pt_regs, XDP_PASS
|
||||
from vmlinux import struct_request, struct_pt_regs
|
||||
from pythonbpf import bpf, section, bpfglobal, compile_to_ir
|
||||
import logging
|
||||
from ctypes import c_int64, c_void_p
|
||||
|
||||
|
||||
@bpf
|
||||
@section("kprobe/blk_mq_start_request")
|
||||
def example(ctx: struct_pt_regs):
|
||||
def example(ctx: struct_pt_regs) -> c_int64:
|
||||
req = struct_request(ctx.di)
|
||||
c = req.__data_len
|
||||
d = XDP_PASS
|
||||
print(f"data length {c} and test {d}")
|
||||
print(f"data length {c}")
|
||||
return c_int64(0)
|
||||
|
||||
|
||||
@bpf
|
||||
|
||||
Reference in New Issue
Block a user