Skip to content

Commit

Permalink
Merge branch 'main' into uid_gid
Browse files Browse the repository at this point in the history
  • Loading branch information
dmah42 authored Aug 21, 2024
2 parents 8a80f07 + ec27929 commit 9be9460
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
23 changes: 9 additions & 14 deletions auraed/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,26 +233,21 @@ pub async fn run(
info!("Loading eBPF probes");

let mut bpf_handle = BpfContext::new();
let process_fork_listener = bpf_handle.load_and_attach_tracepoint_program::<SchedProcessForkTracepointProgram, ForkedProcess>().ok();
let process_exit_listener = bpf_handle.load_and_attach_kprobe_program::<TaskstatsExitKProbeProgram, ProcessExit>().ok();
let posix_signals_listener = bpf_handle.load_and_attach_tracepoint_program::<SignalSignalGenerateTracepointProgram, Signal>().ok();

(
Some(bpf_handle),
(
process_fork_listener,
process_exit_listener,
posix_signals_listener,
),
)
let perf_events = (
bpf_handle.load_and_attach_tracepoint_program::<SchedProcessForkTracepointProgram, ForkedProcess>().ok(),
bpf_handle.load_and_attach_kprobe_program::<TaskstatsExitKProbeProgram, ProcessExit>().ok(),
bpf_handle.load_and_attach_tracepoint_program::<SignalSignalGenerateTracepointProgram, Signal>().ok(),
);

(Some(bpf_handle), perf_events)
};

// Build gRPC Services
let (mut health_reporter, health_service) =
tonic_health::server::health_reporter();

let observe_service = ObserveService::new(
Arc::new(LogChannel::new(String::from("TODO"))),
Arc::new(LogChannel::new(String::from("auraed"))),
perf_events,
);
let observe_service_server =
Expand Down Expand Up @@ -359,4 +354,4 @@ pub fn prep_oci_spec_for_spawn(output: &str) {
AuraeOCIBuilder::new().build().expect("building default oci spec"),
)
.expect("spawning");
}
}
19 changes: 8 additions & 11 deletions auraed/src/observe/observe_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

// @todo @krisnova remove this once logging is further along
#![allow(dead_code)]
//TODO(jeroen) this warning comes from the `perf_events` arument in ObserveService::new()
#![allow(clippy::type_complexity)]

use super::cgroup_cache;
use super::error::ObserveServiceError;
Expand Down Expand Up @@ -52,15 +50,14 @@ pub struct ObserveService {
Arc<Mutex<HashMap<i32, HashMap<LogChannelType, LogChannel>>>>,
}

type PerfEvents = (
Option<PerfEventBroadcast<ForkedProcess>>,
Option<PerfEventBroadcast<ProcessExit>>,
Option<PerfEventBroadcast<Signal>>,
);

impl ObserveService {
pub fn new(
aurae_logger: Arc<LogChannel>,
perf_events: (
Option<PerfEventBroadcast<ForkedProcess>>,
Option<PerfEventBroadcast<ProcessExit>>,
Option<PerfEventBroadcast<Signal>>,
),
) -> Self {
pub fn new(aurae_logger: Arc<LogChannel>, perf_events: PerfEvents) -> Self {
let proc_cache = match perf_events {
(Some(f), Some(e), _) => {
Some(Arc::new(Mutex::new(ProcCache::new(
Expand Down Expand Up @@ -376,4 +373,4 @@ mod tests {

svc.sub_process_consumer_list.lock().await.clear();
}
}
}

0 comments on commit 9be9460

Please sign in to comment.