diff --git a/tarian/c/utils/filters.h b/tarian/c/utils/filters.h index 4866cfe..7810202 100644 --- a/tarian/c/utils/filters.h +++ b/tarian/c/utils/filters.h @@ -17,7 +17,15 @@ stain bool can_proceed() { return true; } +// has_same_pid checks if the event has same pid as the current task. stain bool has_same_pid(uint32_t pid) { + struct task_struct *task = (struct task_struct *)bpf_get_current_task(); + uint32_t c_pid = get_task_ns_tgid(task); + + return (c_pid == pid); +} + +stain bool has_same__host_pid(uint32_t pid) { u64 fpid = bpf_get_current_pid_tgid() >> 32; return (fpid == pid);