diff options
author | edef <edef@unfathomable.blue> | 2022-07-30 19:52:37 +0000 |
---|---|---|
committer | edef <edef@unfathomable.blue> | 2022-07-30 19:52:37 +0000 |
commit | bf43a09f7e1c9ce415aee9733741a0cc5b887ea6 (patch) | |
tree | ec4f3f14b7bc6b7980ee5ac3f461dab5c58de8e3 | |
parent | e68fb769a96f0896c92e8c1884a727d3ead47844 (diff) | |
download | unf-legacy-bf43a09f7e1c9ce415aee9733741a0cc5b887ea6.tar.zst |
ripple/minitrace/syscall_abi: represent RobustListHeadSize with a unit struct
Change-Id: I709870b36d5b2329be53389af6c816aaeadfdd7b
-rw-r--r-- | ripple/minitrace/src/main.rs | 6 | ||||
-rw-r--r-- | 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<Self> { + if reg == 24 { + Some(RobustListHeadSize) + } else { + None + } + } +} |