Skip to content

Commit 99321c7

Browse files
add a failing C test
1 parent 11850d1 commit 99321c7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

pythonbpf/type_deducer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"c_long": ir.IntType(64),
1717
"c_ulong": ir.IntType(64),
1818
"c_longlong": ir.IntType(64),
19+
"c_uint": ir.IntType(32),
1920
# Not so sure about this one
2021
"str": ir.PointerType(ir.IntType(8)),
2122
}

tests/c-form/requests2.bpf.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "vmlinux.h"
2+
#include <bpf/bpf_helpers.h>
3+
#include <bpf/bpf_tracing.h>
4+
#include <bpf/bpf_core_read.h>
5+
6+
char LICENSE[] SEC("license") = "GPL";
7+
8+
SEC("kprobe/blk_mq_start_request")
9+
int example(struct pt_regs *ctx)
10+
{
11+
u64 a = ctx->r15;
12+
struct request *req = (struct request *)(ctx->di);
13+
unsigned int something_ns = req->timeout;
14+
unsigned int data_len = req->__data_len;
15+
bpf_printk("data length %lld %ld %ld\n", data_len, something_ns, a);
16+
17+
return 0;
18+
}

0 commit comments

Comments
 (0)