in src/samplers/krb5kdc/mod.rs [37:65]
fn init_bpf(&mut self) -> Result<(), anyhow::Error> {
#[cfg(feature = "bpf")]
{
let code = include_str!("bpf.c");
let mut bpf = bcc::BPF::new(code)?;
// collect the set of probes required from the statistics enabled.
let mut probes = HashSet::new();
for statistic in &self.statistics {
for probe in statistic.bpf_probes_required(self.path.clone()) {
probes.insert(probe);
}
}
// load + attach the kernel probes that are required to the bpf instance.
for probe in probes {
if let Err(err) = probe.try_attach_to_bpf(&mut bpf) {
if self.common.config().fault_tolerant() {
warn!("krb5kdc unable to attach probe to function {}", &probe.name);
} else {
Err(err)?;
}
}
}
self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf })));
}
Ok(())
}