diff options
-rw-r--r-- | ripple/minitrace/src/main.rs | 10 | ||||
-rw-r--r-- | ripple/minitrace/src/syscall_abi/mod.rs | 26 |
2 files changed, 24 insertions, 12 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index 19be3f2..8b82b72 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -341,16 +341,6 @@ fn check_syscall(entry: &SyscallEntry) -> bool { } } } - SyscallEntry::prlimit64 { - pid, - resource: _, - new_rlim: _, - old_rlim: _, - } => { - if pid != 0 { - return false; - } - } SyscallEntry::getrandom { ubuf: _, len, diff --git a/ripple/minitrace/src/syscall_abi/mod.rs b/ripple/minitrace/src/syscall_abi/mod.rs index c274d0b..e050711 100644 --- a/ripple/minitrace/src/syscall_abi/mod.rs +++ b/ripple/minitrace/src/syscall_abi/mod.rs @@ -4,7 +4,10 @@ use { crate::{define_syscalls, syscall_bitflags, syscall_enums, Process}, - std::ffi::CString, + std::{ + ffi::CString, + fmt::{self, Debug, Write}, + }, }; pub(crate) use arg::{ProcessSyscallArg, SyscallArg}; @@ -43,7 +46,7 @@ define_syscalls! { fn openat(dfd: DirFd, filename: CString, flags: OpenFlags, mode: FileMode) -> i64 = 257; fn newfstatat(dfd: DirFd, filename: CString, statbuf: *mut Stat, flags: AtFlags) -> i64 = 262; fn set_robust_list(head: *mut RobustListHead, len: RobustListHeadSize) -> i64 = 273; - fn prlimit64(pid: i32, resource: ResourceLimit, new_rlim: *const RLimit64, old_rlim: *mut RLimit64) -> i64 = 302; + fn prlimit64(pid: Zero, resource: ResourceLimit, new_rlim: *const RLimit64, old_rlim: *mut RLimit64) -> i64 = 302; fn getrandom(ubuf: *mut u8, len: usize, flags: GrndFlags) -> i64 = 318; } } @@ -126,6 +129,25 @@ syscall_enums! { } } +#[derive(Copy, Clone)] +pub(crate) struct Zero; + +impl Debug for Zero { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_char('0') + } +} + +impl SyscallArg for Zero { + fn try_from_reg(reg: u64) -> Option<Self> { + if reg == 0 { + Some(Zero) + } else { + None + } + } +} + #[derive(Debug, Copy, Clone)] pub(crate) struct SigSetSize; |