|
|
@ -2,13 +2,17 @@ use std::{
|
|
|
|
collections::HashMap,
|
|
|
|
collections::HashMap,
|
|
|
|
error::Error,
|
|
|
|
error::Error,
|
|
|
|
fs, io,
|
|
|
|
fs, io,
|
|
|
|
|
|
|
|
os::raw::c_int,
|
|
|
|
path::{Path, PathBuf},
|
|
|
|
path::{Path, PathBuf},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
use thiserror::Error;
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
|
generated::bpf_map_type::BPF_MAP_TYPE_PERF_EVENT_ARRAY,
|
|
|
|
generated::{
|
|
|
|
|
|
|
|
bpf_map_type::BPF_MAP_TYPE_PERF_EVENT_ARRAY, AYA_PERF_EVENT_IOC_DISABLE,
|
|
|
|
|
|
|
|
AYA_PERF_EVENT_IOC_ENABLE, AYA_PERF_EVENT_IOC_SET_BPF,
|
|
|
|
|
|
|
|
},
|
|
|
|
maps::{Map, MapError, MapLock, MapRef, MapRefMut},
|
|
|
|
maps::{Map, MapError, MapLock, MapRef, MapRefMut},
|
|
|
|
obj::{
|
|
|
|
obj::{
|
|
|
|
btf::{Btf, BtfError},
|
|
|
|
btf::{Btf, BtfError},
|
|
|
@ -24,10 +28,9 @@ use crate::{
|
|
|
|
|
|
|
|
|
|
|
|
pub(crate) const BPF_OBJ_NAME_LEN: usize = 16;
|
|
|
|
pub(crate) const BPF_OBJ_NAME_LEN: usize = 16;
|
|
|
|
|
|
|
|
|
|
|
|
/* FIXME: these are arch dependent */
|
|
|
|
pub(crate) const PERF_EVENT_IOC_ENABLE: c_int = AYA_PERF_EVENT_IOC_ENABLE;
|
|
|
|
pub(crate) const PERF_EVENT_IOC_ENABLE: libc::c_ulong = 9216;
|
|
|
|
pub(crate) const PERF_EVENT_IOC_DISABLE: c_int = AYA_PERF_EVENT_IOC_DISABLE;
|
|
|
|
pub(crate) const PERF_EVENT_IOC_DISABLE: libc::c_ulong = 9217;
|
|
|
|
pub(crate) const PERF_EVENT_IOC_SET_BPF: c_int = AYA_PERF_EVENT_IOC_SET_BPF;
|
|
|
|
pub(crate) const PERF_EVENT_IOC_SET_BPF: libc::c_ulong = 1074013192;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub unsafe trait Pod: Copy + 'static {}
|
|
|
|
pub unsafe trait Pod: Copy + 'static {}
|
|
|
|
|
|
|
|
|
|
|
|