mirror of https://github.com/aya-rs/aya
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			24 lines
		
	
	
		
			537 B
		
	
	
	
		
			Rust
		
	
			
		
		
	
	
			24 lines
		
	
	
		
			537 B
		
	
	
	
		
			Rust
		
	
| use core::ffi::c_void;
 | |
| 
 | |
| use crate::{Argument, EbpfContext, args::raw_tracepoint_arg, bindings::bpf_raw_tracepoint_args};
 | |
| 
 | |
| pub struct RawTracePointContext {
 | |
|     ctx: *mut bpf_raw_tracepoint_args,
 | |
| }
 | |
| 
 | |
| impl RawTracePointContext {
 | |
|     pub fn new(ctx: *mut c_void) -> Self {
 | |
|         Self { ctx: ctx.cast() }
 | |
|     }
 | |
| 
 | |
|     pub fn arg<T: Argument>(&self, n: usize) -> T {
 | |
|         raw_tracepoint_arg(unsafe { &*self.ctx }, n)
 | |
|     }
 | |
| }
 | |
| 
 | |
| impl EbpfContext for RawTracePointContext {
 | |
|     fn as_ptr(&self) -> *mut c_void {
 | |
|         self.ctx.cast()
 | |
|     }
 | |
| }
 |