bpf: Add bindings for uid and gid

pull/438/head
tiann 3 years ago
parent 3e089a61d1
commit 3b04cb5747
No known key found for this signature in database
GPG Key ID: 6D3F65FFD9559C06

@ -25,7 +25,7 @@ pub use aya_bpf_cty as cty;
use core::ffi::c_void;
use cty::{c_int, c_long};
use helpers::{bpf_get_current_comm, bpf_get_current_pid_tgid};
use helpers::{bpf_get_current_comm, bpf_get_current_pid_tgid, bpf_get_current_uid_gid};
pub use aya_bpf_macros as macros;
@ -46,6 +46,14 @@ pub trait BpfContext {
fn tgid(&self) -> u32 {
(bpf_get_current_pid_tgid() >> 32) as u32
}
fn uid(&self) -> u32 {
bpf_get_current_uid_gid() as u32
}
fn gid(&self) -> u32 {
(bpf_get_current_uid_gid() >> 32) as u32
}
}
#[no_mangle]

Loading…
Cancel
Save