From 7bab8b108c1e2c238f9e5745ebdc2860a7cc5fcf Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sun, 14 Jan 2024 19:32:22 +0100 Subject: Send write_syscall events to userspace --- fs-tracer-common/src/lib.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'fs-tracer-common') diff --git a/fs-tracer-common/src/lib.rs b/fs-tracer-common/src/lib.rs index 0c9ac1a..b8fcb1a 100644 --- a/fs-tracer-common/src/lib.rs +++ b/fs-tracer-common/src/lib.rs @@ -1 +1,26 @@ #![no_std] + +use core::fmt::{Formatter, self}; +use core::str; + + +#[derive(Clone, Copy)] +pub struct WriteSyscallBPF { + pub pid: u32, + pub fd: u64, + pub buf: [u8; 128], + pub count: u64, +} + +unsafe impl Sync for WriteSyscallBPF {} + +impl fmt::Debug for WriteSyscallBPF { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.debug_struct("WriteSyscallArgs") + .field("pid", &self.pid) + .field("fd", &self.fd) + .field("buf", &unsafe { str::from_utf8_unchecked(&self.buf) }) + .field("count", &self.count) + .finish() + } +} \ No newline at end of file -- cgit 1.4.1