Skip to content

Commit 55069cc

Browse files
committed
fmt
1 parent 278bd14 commit 55069cc

3 files changed

Lines changed: 21 additions & 22 deletions

File tree

src/base_plugin/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,10 @@ impl EderaPlugin {
545545

546546
let zid = &context.decoded_evt.zone_id;
547547
if matches!(context.fdinfo, Cached::NotFetched) {
548-
context.fdinfo = match self.threadstate.with_zoneinfo(zid, |zinfo| {
549-
zinfo.get_event_fdinfo(&context.decoded_evt)
550-
}) {
548+
context.fdinfo = match self
549+
.threadstate
550+
.with_zoneinfo(zid, |zinfo| zinfo.get_event_fdinfo(&context.decoded_evt))
551+
{
551552
Some(t) => Cached::Found(t),
552553
None => Cached::NotFound,
553554
};

src/parsers.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,16 @@ pub fn get_fdi(event: &ZoneKernelSyscallEvent) -> Option<u64> {
195195

196196
// For exit events (modern_bpf only captures these), search for the FD parameter
197197
// Special case: sendmmsg and recvmmsg have FD at position 1
198-
let maybe_fd_loc: Option<usize> = if etype == PPME_SOCKET_SENDMMSG_X || etype == PPME_SOCKET_RECVMMSG_X {
199-
Some(1)
200-
} else {
201-
// For other exit events, search for the PT_FD parameter
202-
event.event_params
203-
.iter()
204-
.position(|param| param.param_type == param_type::PT_FD as u32)
205-
};
198+
let maybe_fd_loc: Option<usize> =
199+
if etype == PPME_SOCKET_SENDMMSG_X || etype == PPME_SOCKET_RECVMMSG_X {
200+
Some(1)
201+
} else {
202+
// For other exit events, search for the PT_FD parameter
203+
event
204+
.event_params
205+
.iter()
206+
.position(|param| param.param_type == param_type::PT_FD as u32)
207+
};
206208

207209
if let Some(loc) = maybe_fd_loc {
208210
let res = i64::from_ne_bytes(

src/threadstate.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,11 @@ impl ZoneInfo {
8181
/// from event parameters and looks up the corresponding FD info.
8282
///
8383
/// Returns None if the event doesn't use an FD or if the FD info is not found.
84-
pub fn get_event_fdinfo(
85-
&self,
86-
event: &ZoneKernelSyscallEvent,
87-
) -> Option<ZoneKernelFdInfo> {
84+
pub fn get_event_fdinfo(&self, event: &ZoneKernelSyscallEvent) -> Option<ZoneKernelFdInfo> {
8885
// Only exit events are captured by modern_bpf driver
8986
if parsers::has_fd(event) {
9087
parsers::get_fdi(event).and_then(|fdi| {
91-
self.with_leader_fdlist_ctx(event, |fdlist| {
92-
fdlist.get(&fdi).cloned()
93-
})
88+
self.with_leader_fdlist_ctx(event, |fdlist| fdlist.get(&fdi).cloned())
9489
})
9590
} else {
9691
None
@@ -690,7 +685,9 @@ impl ZoneInfo {
690685
// This is the old OPENAT format that required enter event data.
691686
// Modern_bpf generates PPME_SYSCALL_OPENAT_2_X instead (see openat.bpf.c line 20).
692687
// If we somehow receive this event type, we can't process it without enter events.
693-
warn!("Received unsupported PPME_SYSCALL_OPENAT_X event (requires enter event data)");
688+
warn!(
689+
"Received unsupported PPME_SYSCALL_OPENAT_X event (requires enter event data)"
690+
);
694691
return Ok(());
695692
}
696693
PPME_SYSCALL_OPENAT_2_X | PPME_SYSCALL_OPENAT2_X => {
@@ -1656,7 +1653,8 @@ impl ZoneInfo {
16561653
);
16571654

16581655
if tinfo.clone_ts != 0 {
1659-
tinfo.exe_ino_ctime_duration_clone_ts = tinfo.clone_ts.wrapping_sub(tinfo.exe_ino_ctime);
1656+
tinfo.exe_ino_ctime_duration_clone_ts =
1657+
tinfo.clone_ts.wrapping_sub(tinfo.exe_ino_ctime);
16601658
}
16611659

16621660
if tinfo.pidns_init_start_ts != 0 && tinfo.exe_ino_ctime > tinfo.pidns_init_start_ts
@@ -3123,7 +3121,6 @@ impl ZoneInfo {
31233121
}
31243122
}
31253123
}
3126-
31273124
}
31283125

31293126
impl ThreadState {
@@ -3496,7 +3493,6 @@ mod tests {
34963493
assert_eq!(result, Some(100));
34973494
}
34983495

3499-
35003496
#[test]
35013497
fn maybe_get_event_fdinfo_returns_none_no_thread() {
35023498
let zinfo = ZoneInfo::default();

0 commit comments

Comments
 (0)