From bf43a09f7e1c9ce415aee9733741a0cc5b887ea6 Mon Sep 17 00:00:00 2001 From: edef Date: Sat, 30 Jul 2022 19:52:37 +0000 Subject: ripple/minitrace/syscall_abi: represent RobustListHeadSize with a unit struct Change-Id: I709870b36d5b2329be53389af6c816aaeadfdd7b --- ripple/minitrace/src/main.rs | 6 ------ ripple/minitrace/src/syscall_abi/mod.rs | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index 2983e57..19be3f2 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -341,12 +341,6 @@ fn check_syscall(entry: &SyscallEntry) -> bool { } } } - SyscallEntry::set_robust_list { head: _, len } => { - if len != 24 { - panic!("set_robust_list(2) len should be sizeof (struct robust_list_head), actually {len}"); - } - println!("set_robust_list(..)"); - } SyscallEntry::prlimit64 { pid, resource: _, diff --git a/ripple/minitrace/src/syscall_abi/mod.rs b/ripple/minitrace/src/syscall_abi/mod.rs index 6a84679..c274d0b 100644 --- a/ripple/minitrace/src/syscall_abi/mod.rs +++ b/ripple/minitrace/src/syscall_abi/mod.rs @@ -42,7 +42,7 @@ define_syscalls! { fn exit_group(error_code: i32) -> i64 = 231; 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: usize) -> i64 = 273; + 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 getrandom(ubuf: *mut u8, len: usize, flags: GrndFlags) -> i64 = 318; } @@ -138,3 +138,16 @@ impl SyscallArg for SigSetSize { } } } + +#[derive(Debug, Copy, Clone)] +pub(crate) struct RobustListHeadSize; + +impl SyscallArg for RobustListHeadSize { + fn try_from_reg(reg: u64) -> Option { + if reg == 24 { + Some(RobustListHeadSize) + } else { + None + } + } +} -- cgit 1.4.1