Skip to content

Commit

Permalink
change if to match
Browse files Browse the repository at this point in the history
  • Loading branch information
sat0ken committed Oct 2, 2024
1 parent b938ebd commit efcaef1
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions experiment/seccomp/src/seccomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,20 @@ struct Filters {
}

fn get_syscall_number(arc: &Arch, name: &str) -> Option<u64> {
if arc == &Arch::X86 {
match syscalls::x86_64::Sysno::from_str(name) {
Ok(syscall) => Some(syscall as u64),
Err(_) => None,
}
} else {
match syscalls::aarch64::Sysno::from_str(name) {
Ok(syscall) => Some(syscall as u64),
Err(_) => None,
match arc {
&Arch::X86 => {
match syscalls::x86_64::Sysno::from_str(name) {
Ok(syscall) => Some(syscall as u64),
Err(_) => None,
}
},
&Arch::AArch64 => {
match syscalls::aarch64::Sysno::from_str(name) {
Ok(syscall) => Some(syscall as u64),
Err(_) => None,
}
}
}

}

#[derive(Debug)]
Expand Down

0 comments on commit efcaef1

Please sign in to comment.