about summary refs log tree commit diff
path: root/fs-tracer-common
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2024-01-14 19:32:22 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2024-01-14 19:32:22 +0100
commit7bab8b108c1e2c238f9e5745ebdc2860a7cc5fcf (patch)
treea4252a8a019d1392cc2959b024248edf34ff24a2 /fs-tracer-common
parentHandle write syscall (diff)
downloadfs-tracer-7bab8b108c1e2c238f9e5745ebdc2860a7cc5fcf.tar.gz
fs-tracer-7bab8b108c1e2c238f9e5745ebdc2860a7cc5fcf.tar.bz2
fs-tracer-7bab8b108c1e2c238f9e5745ebdc2860a7cc5fcf.zip
Send write_syscall events to userspace
Diffstat (limited to 'fs-tracer-common')
-rw-r--r--fs-tracer-common/src/lib.rs25
1 files changed, 25 insertions, 0 deletions
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