Skip to content

Commit

Permalink
feat(RuleSet): impl RuleSet for syscalls::Sysno to avoid definining t…
Browse files Browse the repository at this point in the history
…ypes for single syscalls
  • Loading branch information
sivizius committed Nov 13, 2023
1 parent 430d3ea commit 908e6cd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,20 @@ impl<T: ?Sized + RuleSet> RuleSet for &T {
}
}

impl RuleSet for syscalls::Sysno {
fn simple_rules(&self) -> Vec<syscalls::Sysno> {
Vec::from([self])
}

fn conditional_rules(&self) -> HashMap<syscalls::Sysno, Vec<SeccompRule>> {
HashMap::new()
}

fn name(&self) -> &'static str {
self.name()
}
}

#[must_use]
/// A struct representing a set of rules to be loaded into a seccomp filter and applied to the
/// current thread, or all threads in the current process.
Expand Down

0 comments on commit 908e6cd

Please sign in to comment.