mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
add a failing C test
This commit is contained in:
@ -16,6 +16,7 @@ mapping = {
|
|||||||
"c_long": ir.IntType(64),
|
"c_long": ir.IntType(64),
|
||||||
"c_ulong": ir.IntType(64),
|
"c_ulong": ir.IntType(64),
|
||||||
"c_longlong": ir.IntType(64),
|
"c_longlong": ir.IntType(64),
|
||||||
|
"c_uint": ir.IntType(32),
|
||||||
# Not so sure about this one
|
# Not so sure about this one
|
||||||
"str": ir.PointerType(ir.IntType(8)),
|
"str": ir.PointerType(ir.IntType(8)),
|
||||||
}
|
}
|
||||||
|
|||||||
18
tests/c-form/requests2.bpf.c
Normal file
18
tests/c-form/requests2.bpf.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "vmlinux.h"
|
||||||
|
#include <bpf/bpf_helpers.h>
|
||||||
|
#include <bpf/bpf_tracing.h>
|
||||||
|
#include <bpf/bpf_core_read.h>
|
||||||
|
|
||||||
|
char LICENSE[] SEC("license") = "GPL";
|
||||||
|
|
||||||
|
SEC("kprobe/blk_mq_start_request")
|
||||||
|
int example(struct pt_regs *ctx)
|
||||||
|
{
|
||||||
|
u64 a = ctx->r15;
|
||||||
|
struct request *req = (struct request *)(ctx->di);
|
||||||
|
unsigned int something_ns = req->timeout;
|
||||||
|
unsigned int data_len = req->__data_len;
|
||||||
|
bpf_printk("data length %lld %ld %ld\n", data_len, something_ns, a);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user