We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ece01d6 commit 80a2b48Copy full SHA for 80a2b48
samples/trace_event/src/main.rs
@@ -15,7 +15,7 @@ pub const TASK_COMM_LEN: usize = 16;
15
#[repr(C)]
16
#[derive(Copy, Clone)]
17
pub struct KeyT {
18
- pub comm: [i8; TASK_COMM_LEN],
+ pub comm: [u8; TASK_COMM_LEN],
19
pub kernstack: u32,
20
pub userstack: u32,
21
}
@@ -50,7 +50,10 @@ fn rex_prog1(obj: &perf_event, ctx: &bpf_perf_event_data) -> Result {
50
51
obj.bpf_get_current_task()
52
.map(|t| {
53
- t.get_comm(&mut key.comm);
+ let prog_name = t.get_comm().unwrap_or_default();
54
+ key.comm
55
+ .copy_from_slice(&prog_name.to_bytes()[..TASK_COMM_LEN]);
56
+ key.comm[TASK_COMM_LEN - 1] = 0;
57
0u64
58
})
59
.ok_or(0i32)?;
0 commit comments