diff options
Diffstat (limited to 'ripple/minitrace/src')
-rw-r--r-- | ripple/minitrace/src/main.rs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index fce614d..e7da54e 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -134,10 +134,11 @@ fn libc_check<T: Debug + Eq + fmt::LowerHex>( (our_name, our_value): (&'static str, T), (libc_name, libc_value): (&'static str, T), ) { - assert!( - libc_name.ends_with(our_name), - "{libc_name} doesn't end with {our_name}" - ); + match () { + _ if libc_name.ends_with(our_name) => {} + _ if libc_name.starts_with(&format!("{our_name}_")) => {} + () => panic!("{libc_name} doesn't match {our_name}"), + } assert!( our_value == libc_value, @@ -347,7 +348,7 @@ define_syscalls! { fn rt_sigaction(sig: i32, act: *const SigAction, oact: *mut SigAction, sigsetsize: usize) -> i64 = 13; fn ioctl(fd: FileDesc, cmd: Ioctl, arg: u64) -> i64 = 16; fn pread64(fd: FileDesc, buf: *mut u8, count: usize, pos: u64) -> i64 = 17; - fn access(filename: CString, mode: i32) -> i64 = 21; + fn access(filename: CString, mode: AccessMode) -> i64 = 21; fn getcwd(buf: *mut u8, size: u64) -> i64 = 79; fn readlink(path: CString, buf: *mut u8, bufsiz: i32) -> i64 = 89; fn sysinfo(info: *mut SysInfo) -> i64 = 99; @@ -477,11 +478,8 @@ fn check_syscall(entry: &SyscallEntry) -> bool { SyscallEntry::mprotect { addr, len, prot: _ } => { return addr % 4096 == 0 && len % 4096 == 0; } - SyscallEntry::access { - ref filename, - mode: _, - } => { - println!("access({filename:?}, ..)"); + SyscallEntry::access { ref filename, mode } => { + println!("access({filename:?}, {mode:?})"); } SyscallEntry::readlink { ref path, @@ -585,6 +583,13 @@ syscall_bitflags! { struct AtFlags: i32 { const EMPTY_PATH = 1 << 12 => AT_EMPTY_PATH; } + + struct AccessMode: i32 { + const F = 0 => F_OK; + const X = 1 << 0 => X_OK; + const W = 1 << 1 => W_OK; + const R = 1 << 2 => R_OK; + } } syscall_enums! { |