Skip to content

Commit

Permalink
fix: fd should be 8 bytes
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Hilgers <[email protected]>
  • Loading branch information
fhilgers committed Dec 3, 2024
1 parent e3ac705 commit 594b81b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions rust/backend/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ pub struct SysSendmsgCall {
pub pid: u32,
pub tid: u32,
pub begin_time_stamp: u64,
pub fd: i32,
pub fd: u64,
pub duration_nano_sec: u64, // in nanoseconds
}

impl SysSendmsgCall {
pub fn new(pid: u32, tid: u32, begin_time_stamp: u64, fd: i32, duration_nano_sec: u64) -> Self {
pub fn new(pid: u32, tid: u32, begin_time_stamp: u64, fd: u64, duration_nano_sec: u64) -> Self {
Self { pid, tid, begin_time_stamp, fd, duration_nano_sec }
}
}
Expand All @@ -47,4 +47,4 @@ pub fn generate_id(pid: u32, tgid: u32) -> u64{
let tgid_u64 = tgid as u64;

(pid_u64 << 32) | tgid_u64
}
}
6 changes: 3 additions & 3 deletions rust/backend/ebpf/src/sys_sendmsg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ static SYS_SENDMSG_TIMESTAMPS: HashMap<u64, SysSendmsgIntern> = HashMap::with_ma

struct SysSendmsgIntern {
begin_time_stamp: u64,
fd: i32,
fd: u64,
}

#[tracepoint]
pub fn sys_enter_sendmsg(ctx: TracePointContext) -> u32 {
let id = generate_id(ctx.pid(), ctx.tgid());

let begin_time_stamp;
let fd: i32;
let fd: u64;
unsafe {
fd = match ctx.read_at(16) {
Ok(arg) => arg,
Expand Down Expand Up @@ -84,4 +84,4 @@ pub fn sys_exit_sendmsg(ctx: TracePointContext) -> u32 {


0
}
}
2 changes: 1 addition & 1 deletion rust/shared/proto/ziofa.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ message SysSendmsgEvent {
uint32 pid = 1;
uint32 tid = 2;
uint64 begin_time_stamp = 3;
int32 fd = 4;
uint64 fd = 4;
uint64 duration_micro_sec = 5;
}

0 comments on commit 594b81b

Please sign in to comment.