about summary refs log tree commit diff
path: root/fs-tracer-common/src/lib.rs
blob: 77ee0e5f87326986a0c2b6340e1ffb7a116e2cd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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", &str::from_utf8(&self.buf).unwrap_or("") )
            .field("count", &self.count)
            .finish()
    }
}