diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-07-20 21:52:05 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-07-20 21:52:05 +0200 |
commit | 8ca287a13f71bf31bc5922f8b81c671cffba9e82 (patch) | |
tree | 0df4e418195b8becf1766729ca88a1875d34eeaf /fs-tracer-ebpf/src/syscalls/write.rs | |
parent | Syscalls: Write: Fix types (diff) | |
download | fs-tracer-8ca287a13f71bf31bc5922f8b81c671cffba9e82.tar.gz fs-tracer-8ca287a13f71bf31bc5922f8b81c671cffba9e82.tar.bz2 fs-tracer-8ca287a13f71bf31bc5922f8b81c671cffba9e82.zip |
Syscalls: Write: Fix struct packing
Diffstat (limited to 'fs-tracer-ebpf/src/syscalls/write.rs')
-rw-r--r-- | fs-tracer-ebpf/src/syscalls/write.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs-tracer-ebpf/src/syscalls/write.rs b/fs-tracer-ebpf/src/syscalls/write.rs index b236887..951b297 100644 --- a/fs-tracer-ebpf/src/syscalls/write.rs +++ b/fs-tracer-ebpf/src/syscalls/write.rs @@ -20,6 +20,7 @@ pub fn handle_sys_write( unsafe fn handle_sys_write_enter(ctx: TracePointContext) -> Result<c_long, c_long> { // info!(&ctx, "handle_sys_write start"); + #[repr(C)] #[derive(Clone, Copy)] struct WriteSyscallArgs { fd: c_int, @@ -39,7 +40,16 @@ unsafe fn handle_sys_write_enter(ctx: TracePointContext) -> Result<c_long, c_lon let mut anotherbuf = [0u8; 96]; let _ = bpf_probe_read_kernel_str_bytes(buf_ref.as_ptr(), &mut anotherbuf); - // info!(&ctx, "handle_sys_write fd: {} pid: {}", args.fd, ctx.pid()); + info!( + &ctx, + "handle_sys_write fd: {} pid: {} count: {}", + args.fd, + ctx.pid(), + args.count + ); + info!(&ctx, "buf: {}", unsafe { + str::from_utf8_unchecked(buf_ref) + }); let tgid: u32 = ctx.tgid(); let _ = SYSCALL_ENTERS.insert( |