diff options
Diffstat (limited to 'ripple/minitrace/src')
-rw-r--r-- | ripple/minitrace/src/main.rs | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index c63cd88..811f6a9 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -263,6 +263,11 @@ fn main() -> Result<()> { panic!("invalid syscall {entry:?}"); } + match entry { + SyscallEntry::times { .. } => {} + _ => println!("{entry:?}"), + } + syscall_state = Some(EntryExit::Entry(entry)); } (Some(EntryExit::Entry(entry)), WaitStatus::PtraceSyscall(event_tid)) => { @@ -304,30 +309,19 @@ fn check_syscall(entry: &SyscallEntry) -> bool { } match fd { - None => { - return flags.contains(MapFlags::ANONYMOUS) && off == 0; - } + None => flags.contains(MapFlags::ANONYMOUS) && off == 0, Some(_) => { - return flags.intersection(MapFlags::PRIVATE | MapFlags::ANONYMOUS) - == MapFlags::PRIVATE; + flags.intersection(MapFlags::PRIVATE | MapFlags::ANONYMOUS) == MapFlags::PRIVATE } } } - SyscallEntry::mprotect { addr, len, prot: _ } => { - return addr % 4096 == 0 && len % 4096 == 0; - } + SyscallEntry::mprotect { addr, len, prot: _ } => addr % 4096 == 0 && len % 4096 == 0, SyscallEntry::openat { dfd, - ref filename, - flags, + filename: _, + flags: _, mode: _, - } => { - if dfd != DirFd::Cwd { - return false; - } - - println!("openat({dfd:?}, {filename:?}, {flags:?}, ..)"); - } + } => dfd == DirFd::Cwd, SyscallEntry::newfstatat { dfd, ref filename, @@ -337,18 +331,12 @@ fn check_syscall(entry: &SyscallEntry) -> bool { match (dfd, filename.as_bytes()) { (_, b"") if !flags.contains(AtFlags::EMPTY_PATH) => { // empty path without AT_EMPTY_PATH - return false; - } - (DirFd::Cwd, _) | (_, b"") => { - println!("newfstatat({dfd:?}, {filename:?}, .., {flags:?})"); - } - _ => { - return false; + false } + (DirFd::Cwd, _) | (_, b"") => true, + _ => false, } } - SyscallEntry::times { .. } => {} - _ => println!("{entry:?}"), + _ => true, } - true } |