change the way loading stack_argument bpf bytes.

pull/773/head
pdliyan 2 years ago
parent e807cb7da9
commit a2201e6698

@ -11,6 +11,8 @@ pub const TEXT_64_64_RELOC: &[u8] =
include_bytes_aligned!(concat!(env!("OUT_DIR"), "/text_64_64_reloc.o"));
pub const LOG: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/log"));
pub const STACK_ARGUMENT: &[u8] =
include_bytes_aligned!(concat!(env!("OUT_DIR"), "/stack_argument"));
pub const MAP_TEST: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/map_test"));
pub const NAME_TEST: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/name_test"));
pub const PASS: &[u8] = include_bytes_aligned!(concat!(env!("OUT_DIR"), "/pass"));

@ -5,6 +5,8 @@ use bytes::BytesMut;
use log::warn;
use tokio::task;
use crate::STACK_ARGUMENT;
pub struct Args {
a_0: u64,
a_1: u64,
@ -17,20 +19,6 @@ pub struct Args {
a_7: i64,
}
impl Args {
fn new() -> Self {
Self {
a_0: 0,
a_1: 0,
a_2: 0,
a_3: 0,
a_4: 0,
a_5: 0,
a_6: 0,
a_7: 0,
}
}
}
#[no_mangle]
#[inline(never)]
pub extern "C" fn trigger_stack_argument(
@ -48,9 +36,7 @@ pub extern "C" fn trigger_stack_argument(
#[tokio::test]
async fn stack_argument() {
let bytes =
include_bytes_aligned!("../../../../target/bpfel-unknown-none/release/stack_argument");
let mut bpf = Bpf::load(bytes).unwrap();
let mut bpf = Bpf::load(crate::STACK_ARGUMENT).unwrap();
if let Err(e) = BpfLogger::init(&mut bpf) {
warn!("failed to initialize eBPF logger: {}", e);

Loading…
Cancel
Save