use std::collections::{HashMap, HashSet};
use syscalls::Sysno;
use crate::{Rule, RuleSet};
pub struct Time {
allowed: HashSet<Sysno>,
}
impl Time {
#[must_use]
pub fn nothing() -> Time {
Time {
allowed: HashSet::new(),
}
}
#[must_use]
pub fn allow_gettime(mut self) -> Time {
self.allowed
.extend([Sysno::clock_gettime, Sysno::clock_getres]);
self
}
}
impl RuleSet for Time {
fn simple_rules(&self) -> Vec<Sysno> {
self.allowed.iter().copied().collect()
}
fn conditional_rules(&self) -> HashMap<Sysno, Vec<Rule>> {
HashMap::new()
}
fn name(&self) -> &'static str {
"Time"
}
}