diff --git a/aya-log-common/src/lib.rs b/aya-log-common/src/lib.rs index d6a063164..7c5225eba 100644 --- a/aya-log-common/src/lib.rs +++ b/aya-log-common/src/lib.rs @@ -7,8 +7,6 @@ use core::{ use num_enum::IntoPrimitive; -pub const LOG_BUF_CAPACITY: usize = 8192; - pub const LOG_FIELDS: usize = 6; pub type LogValueLength = u16; @@ -173,17 +171,12 @@ pub(crate) fn write(tag: u8, value: &[u8], buf: &mut [u8]) -> Option None, }?; let mut size = 0; - macro_rules! copy_from_slice { - ($value:expr) => {{ - let buf = buf.get_mut(size..)?; - let buf = buf.get_mut(..$value.len())?; - buf.copy_from_slice($value); - size += $value.len(); - }}; + for slice in [&[tag][..], &wire_len.to_ne_bytes()[..], value] { + let buf = buf.get_mut(size..)?; + let buf = buf.get_mut(..slice.len())?; + buf.copy_from_slice(slice); + size += slice.len(); } - copy_from_slice!(&[tag]); - copy_from_slice!(&wire_len.to_ne_bytes()); - copy_from_slice!(value); NonZeroUsize::new(size) } @@ -320,33 +313,17 @@ pub fn write_record_header( ) -> Option { let level: u8 = level.into(); let mut size = 0; - macro_rules! write { - ($tag:expr, $value:expr) => {{ - let buf = buf.get_mut(size..)?; - let len = write($tag.into(), $value, buf)?; - size += len.get(); - }}; + for (tag, value) in [ + (RecordField::Target, target.as_bytes()), + (RecordField::Level, &level.to_ne_bytes()), + (RecordField::Module, module.as_bytes()), + (RecordField::File, file.as_bytes()), + (RecordField::Line, &line.to_ne_bytes()), + (RecordField::NumArgs, &num_args.to_ne_bytes()), + ] { + let buf = buf.get_mut(size..)?; + let len = write(tag.into(), value, buf)?; + size += len.get(); } - write!(RecordField::Target, target.as_bytes()); - write!(RecordField::Level, &level.to_ne_bytes()); - write!(RecordField::Module, module.as_bytes()); - write!(RecordField::File, file.as_bytes()); - write!(RecordField::Line, &line.to_ne_bytes()); - write!(RecordField::NumArgs, &num_args.to_ne_bytes()); NonZeroUsize::new(size) } - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn log_value_length_sufficient() { - assert!( - LOG_BUF_CAPACITY <= LogValueLength::MAX.into(), - "{} > {}", - LOG_BUF_CAPACITY, - LogValueLength::MAX - ); - } -} diff --git a/aya-log-ebpf-macros/src/expand.rs b/aya-log-ebpf-macros/src/expand.rs index b49b30214..890ffdc76 100644 --- a/aya-log-ebpf-macros/src/expand.rs +++ b/aya-log-ebpf-macros/src/expand.rs @@ -69,22 +69,27 @@ impl Parse for LogArgs { } pub(crate) fn log(args: LogArgs, level: Option) -> Result { - let ctx = args.ctx; - let target = match args.target { + let LogArgs { + ctx, + target, + level: level_expr, + format_string, + formatting_args, + } = args; + let target = match target { Some(t) => quote! { #t }, None => quote! { module_path!() }, }; - let lvl: TokenStream = if let Some(l) = level { - l - } else if let Some(l) = args.level { - quote! { #l } - } else { - return Err(Error::new( - args.format_string.span(), - "missing `level` argument: try passing an `aya_log_ebpf::Level` value", - )); + let level = match level { + Some(l) => l, + None => { + let l = level_expr.ok_or(Error::new( + format_string.span(), + "missing `level` argument: try passing an `aya_log_ebpf::Level` value", + ))?; + quote! { #l } + } }; - let format_string = args.format_string; let format_string_val = format_string.value(); let fragments = parse(&format_string_val).map_err(|e| { @@ -101,7 +106,7 @@ pub(crate) fn log(args: LogArgs, level: Option) -> Result values.push(quote!(#s)), Fragment::Parameter(p) => { - let arg = match args.formatting_args { + let arg = match formatting_args { Some(ref args) => args[arg_i].clone(), None => return Err(Error::new(format_string.span(), "no arguments provided")), }; @@ -141,19 +146,21 @@ pub(crate) fn log(args: LogArgs, level: Option) -> Result {}, - Some(::aya_log_ebpf::LogBuf { buf }) => { + Some(::aya_log_ebpf::macro_support::LogBuf { buf: #buf }) => { + // Silence unused variable warning; we may need ctx in the future. + let _ = #ctx; let _: Option<()> = (|| { - let #size = ::aya_log_ebpf::write_record_header( - buf, + let #size = ::aya_log_ebpf::macro_support::write_record_header( + #buf, #target, - #lvl, + #level, module_path!(), file!(), line!(), @@ -161,13 +168,14 @@ pub(crate) fn log(args: LogArgs, level: Option) -> Result::ok(::aya_log_ebpf::macro_support::AYA_LOGS.output(#record, 0)) })(); } } diff --git a/aya-log/CHANGELOG.md b/aya-log/CHANGELOG.md index 3b99a7160..5eb0e76d2 100644 --- a/aya-log/CHANGELOG.md +++ b/aya-log/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Breaking Changes + +- The implementation is now backed by a ring buffer rather than a perf event array. This should + improve performance but increases the minimum supported kernel version to 5.8. + +- Drop the built-in `tokio` dependency. Users must now BYOR (bring your own runtime). + ## v0.2.1 (2024-10-09) ### Chore diff --git a/aya-log/Cargo.toml b/aya-log/Cargo.toml index be672108a..d1e7234cc 100644 --- a/aya-log/Cargo.toml +++ b/aya-log/Cargo.toml @@ -17,16 +17,15 @@ rust-version.workspace = true workspace = true [dependencies] -aya = { path = "../aya", version = "^0.13.1", features = ["async_tokio"] } +aya = { path = "../aya", version = "^0.13.1", default-features = false } aya-log-common = { path = "../aya-log-common", version = "^0.1.15", default-features = false } -bytes = { workspace = true } log = { workspace = true } thiserror = { workspace = true } -tokio = { workspace = true, features = ["rt"] } [dev-dependencies] env_logger = { workspace = true } testing_logger = { workspace = true } +tokio = { workspace = true, features = ["net", "rt"] } [lib] path = "src/lib.rs" diff --git a/aya-log/README.md b/aya-log/README.md index ee23c5e2f..765247c9a 100644 --- a/aya-log/README.md +++ b/aya-log/README.md @@ -38,7 +38,15 @@ use aya_log::EbpfLogger; env_logger::init(); // Will log using the default logger, which is TermLogger in this case -EbpfLogger::init(&mut bpf).unwrap(); +let logger = EbpfLogger::init(&mut bpf).unwrap(); +let mut logger = tokio::io::unix::AsyncFd::with_interest(logger, tokio::io::Interest::READABLE).unwrap(); +tokio::task::spawn(async move { + loop { + let mut guard = logger.readable_mut().await.unwrap(); + guard.get_inner_mut().flush(); + guard.clear_ready(); + } +}); ``` ### eBPF code diff --git a/aya-log/src/lib.rs b/aya-log/src/lib.rs index 6560a9a2d..e34c3ba6a 100644 --- a/aya-log/src/lib.rs +++ b/aya-log/src/lib.rs @@ -3,8 +3,8 @@ //! This is the user space side of the [Aya] logging framework. For the eBPF //! side, see the `aya-log-ebpf` crate. //! -//! `aya-log` provides the [EbpfLogger] type, which reads log records created by -//! `aya-log-ebpf` and logs them using the [log] crate. Any logger that +//! `aya-log` provides functions which read log records created by +//! `aya-log-ebpf` and log them using the [log] crate. Any logger that //! implements the [Log] trait can be used with this crate. //! //! # Example: @@ -19,7 +19,15 @@ //! env_logger::init(); //! //! // start reading aya-log records and log them using the default logger -//! EbpfLogger::init(&mut bpf).unwrap(); +//! let logger = EbpfLogger::init(&mut bpf).unwrap(); +//! let mut logger = tokio::io::unix::AsyncFd::with_interest(logger, tokio::io::Interest::READABLE).unwrap(); +//! tokio::task::spawn(async move { +//! loop { +//! let mut guard = logger.readable_mut().await.unwrap(); +//! guard.get_inner_mut().flush(); +//! guard.clear_ready(); +//! } +//! }); //! ``` //! //! With the following eBPF code: @@ -51,27 +59,20 @@ //! use std::{ fmt::{LowerHex, UpperHex}, - io, mem, + mem, net::{Ipv4Addr, Ipv6Addr}, + os::fd::AsRawFd, ptr, str, - sync::Arc, }; const MAP_NAME: &str = "AYA_LOGS"; use aya::{ Ebpf, Pod, - maps::{ - Map, MapData, MapError, MapInfo, - perf::{AsyncPerfEventArray, Events, PerfBufferError}, - }, + maps::{Map, MapData, MapError, MapInfo, RingBuf}, programs::{ProgramError, loaded_programs}, - util::online_cpus, }; -use aya_log_common::{ - Argument, DisplayHint, LOG_BUF_CAPACITY, LOG_FIELDS, Level, LogValueLength, RecordField, -}; -use bytes::BytesMut; +use aya_log_common::{Argument, DisplayHint, LOG_FIELDS, Level, LogValueLength, RecordField}; use log::{Log, Record, error}; use thiserror::Error; @@ -92,54 +93,61 @@ unsafe impl Pod for DisplayHintWrapper {} /// Log messages generated by `aya_log_ebpf` using the [log] crate. /// /// For more details see the [module level documentation](crate). -pub struct EbpfLogger; +pub struct EbpfLogger { + ring_buf: RingBuf, + logger: T, +} + +impl AsRawFd for EbpfLogger { + fn as_raw_fd(&self) -> std::os::unix::prelude::RawFd { + let Self { + ring_buf, + logger: _, + } = self; + ring_buf.as_raw_fd() + } +} /// Log messages generated by `aya_log_ebpf` using the [log] crate. #[deprecated(since = "0.2.1", note = "Use `aya_log::EbpfLogger` instead")] -pub type BpfLogger = EbpfLogger; +pub type BpfLogger = EbpfLogger; -impl EbpfLogger { +impl EbpfLogger<&'static dyn Log> { /// Starts reading log records created with `aya-log-ebpf` and logs them /// with the default logger. See [log::logger]. - pub fn init(bpf: &mut Ebpf) -> Result { - EbpfLogger::init_with_logger(bpf, log::logger()) - } - - /// Starts reading log records created with `aya-log-ebpf` and logs them - /// with the given logger. - pub fn init_with_logger( - bpf: &mut Ebpf, - logger: T, - ) -> Result { - let map = bpf.take_map(MAP_NAME).ok_or(Error::MapNotFound)?; - Self::read_logs_async(map, logger)?; - Ok(EbpfLogger {}) + pub fn init(bpf: &mut Ebpf) -> Result { + Self::init_with_logger(bpf, log::logger()) } /// Attaches to an existing `aya-log-ebpf` instance. /// /// Attaches to the logs produced by `program_id`. Can be used to read logs generated by a /// pinned program. The log records will be written to the default logger. See [log::logger]. - pub fn init_from_id(program_id: u32) -> Result { + pub fn init_from_id(program_id: u32) -> Result { Self::init_from_id_with_logger(program_id, log::logger()) } +} + +impl EbpfLogger { + /// Starts reading log records created with `aya-log-ebpf` and logs them + /// with the given logger. + pub fn init_with_logger(bpf: &mut Ebpf, logger: T) -> Result { + let map = bpf.take_map(MAP_NAME).ok_or(Error::MapNotFound)?; + Self::new(map, logger) + } /// Attaches to an existing `aya-log-ebpf` instance and logs with the given logger. /// /// Attaches to the logs produced by `program_id`. Can be used to read logs generated by a /// pinned program. The log records will be written to the given logger. - pub fn init_from_id_with_logger( - program_id: u32, - logger: T, - ) -> Result { + pub fn init_from_id_with_logger(program_id: u32, logger: T) -> Result { let program_info = loaded_programs() .filter_map(|info| info.ok()) .find(|info| info.id() == program_id) .ok_or(Error::ProgramNotFound)?; let map = program_info - .map_ids() - .map_err(Error::ProgramError)? + .map_ids()? .ok_or_else(|| Error::MapNotFound)? .iter() .filter_map(|id| MapInfo::from_id(*id).ok()) @@ -148,34 +156,23 @@ impl EbpfLogger { None => false, }) .ok_or(Error::MapNotFound)?; - let map = MapData::from_id(map.id()).map_err(Error::MapError)?; + let map = MapData::from_id(map.id())?; - Self::read_logs_async(Map::PerfEventArray(map), logger)?; - - Ok(EbpfLogger {}) + Self::new(Map::RingBuf(map), logger) } - fn read_logs_async(map: Map, logger: T) -> Result<(), Error> { - let mut logs: AsyncPerfEventArray<_> = map.try_into()?; - - let logger = Arc::new(logger); - for cpu_id in online_cpus().map_err(|(_, error)| Error::InvalidOnlineCpu(error))? { - let mut buf = logs.open(cpu_id, None)?; - - let log = logger.clone(); - tokio::spawn(async move { - let mut buffers = vec![BytesMut::with_capacity(LOG_BUF_CAPACITY); 10]; + fn new(map: Map, logger: T) -> Result { + let ring_buf: RingBuf<_> = map.try_into()?; - loop { - let Events { read, lost: _ } = buf.read_events(&mut buffers).await.unwrap(); + Ok(EbpfLogger { ring_buf, logger }) + } - for buf in buffers.iter().take(read) { - log_buf(buf.as_ref(), &*log).unwrap(); - } - } - }); + /// Reads log records from eBPF and writes them to the logger. + pub fn flush(&mut self) { + let Self { ring_buf, logger } = self; + while let Some(buf) = ring_buf.next() { + log_buf(buf.as_ref(), logger).unwrap(); } - Ok(()) } } @@ -439,18 +436,12 @@ impl_format_float!(f64); #[derive(Error, Debug)] pub enum Error { - #[error("log event array {} doesn't exist", MAP_NAME)] + #[error("{} not found", MAP_NAME)] MapNotFound, - #[error("error opening log event array")] + #[error(transparent)] MapError(#[from] MapError), - #[error("error opening log buffer")] - PerfBufferError(#[from] PerfBufferError), - - #[error("invalid /sys/devices/system/cpu/online format")] - InvalidOnlineCpu(#[source] io::Error), - #[error("program not found")] ProgramNotFound, @@ -458,7 +449,7 @@ pub enum Error { ProgramError(#[from] ProgramError), } -fn log_buf(mut buf: &[u8], logger: &dyn Log) -> Result<(), ()> { +fn log_buf(mut buf: &[u8], logger: &T) -> Result<(), ()> { let mut target = None; let mut level = None; let mut module = None; diff --git a/aya/src/maps/perf/perf_event_array.rs b/aya/src/maps/perf/perf_event_array.rs index 66659243e..c825178ae 100644 --- a/aya/src/maps/perf/perf_event_array.rs +++ b/aya/src/maps/perf/perf_event_array.rs @@ -64,7 +64,7 @@ impl> AsFd for PerfEventArrayBuffer { impl> AsRawFd for PerfEventArrayBuffer { fn as_raw_fd(&self) -> RawFd { - self.buf.as_fd().as_raw_fd() + self.as_fd().as_raw_fd() } } diff --git a/aya/src/maps/ring_buf.rs b/aya/src/maps/ring_buf.rs index de02cc05c..79bf8f1c4 100644 --- a/aya/src/maps/ring_buf.rs +++ b/aya/src/maps/ring_buf.rs @@ -9,7 +9,7 @@ use std::{ fmt::{self, Debug, Formatter}, mem, ops::Deref, - os::fd::{AsFd as _, AsRawFd, BorrowedFd, RawFd}, + os::fd::{AsFd, AsRawFd, BorrowedFd, RawFd}, sync::atomic::{AtomicU32, AtomicUsize, Ordering}, }; @@ -130,15 +130,20 @@ impl RingBuf { } } -/// Access to the RawFd can be used to construct an AsyncFd for use with epoll. -impl> AsRawFd for RingBuf { - fn as_raw_fd(&self) -> RawFd { +impl> AsFd for RingBuf { + fn as_fd(&self) -> BorrowedFd<'_> { let Self { map, consumer: _, producer: _, } = self; - map.borrow().fd().as_fd().as_raw_fd() + map.borrow().fd().as_fd() + } +} + +impl> AsRawFd for RingBuf { + fn as_raw_fd(&self) -> RawFd { + self.as_fd().as_raw_fd() } } diff --git a/ebpf/aya-log-ebpf/src/lib.rs b/ebpf/aya-log-ebpf/src/lib.rs index e4aa251a3..0a3f14212 100644 --- a/ebpf/aya-log-ebpf/src/lib.rs +++ b/ebpf/aya-log-ebpf/src/lib.rs @@ -1,39 +1,37 @@ #![no_std] #![warn(clippy::cast_lossless, clippy::cast_sign_loss)] -#[cfg(target_arch = "bpf")] -use aya_ebpf::macros::map; -use aya_ebpf::maps::{PerCpuArray, PerfEventByteArray}; -pub use aya_log_common::{LOG_BUF_CAPACITY, Level, WriteToBuf, write_record_header}; pub use aya_log_ebpf_macros::{debug, error, info, log, trace, warn}; -#[doc(hidden)] -#[repr(C)] -pub struct LogBuf { - pub buf: [u8; LOG_BUF_CAPACITY], -} - -#[doc(hidden)] -// This cfg_attr prevents compilation failures on macOS where the generated section name doesn't -// meet mach-o's requirements. We wouldn't ordinarily build this crate for macOS, but we do so -// because the integration-test crate depends on this crate transitively. See comment in -// test/integration-test/Cargo.toml. -#[cfg_attr(target_arch = "bpf", map)] -pub static AYA_LOG_BUF: PerCpuArray = PerCpuArray::with_max_entries(1, 0); - -#[doc(hidden)] -// This cfg_attr prevents compilation failures on macOS where the generated section name doesn't -// meet mach-o's requirements. We wouldn't ordinarily build this crate for macOS, but we do so -// because the integration-test crate depends on this crate transitively. See comment in -// test/integration-test/Cargo.toml. -#[cfg_attr(target_arch = "bpf", map)] -pub static AYA_LOGS: PerfEventByteArray = PerfEventByteArray::new(0); - #[doc(hidden)] pub mod macro_support { + #[cfg(target_arch = "bpf")] + use aya_ebpf::macros::map; + use aya_ebpf::maps::{PerCpuArray, RingBuf}; + use aya_log_common::LogValueLength; pub use aya_log_common::{ - DefaultFormatter, DisplayHint, IpFormatter, LOG_BUF_CAPACITY, Level, LowerHexFormatter, - LowerMacFormatter, UpperHexFormatter, UpperMacFormatter, + DefaultFormatter, DisplayHint, IpFormatter, Level, LowerHexFormatter, LowerMacFormatter, + UpperHexFormatter, UpperMacFormatter, WriteToBuf, write_record_header, }; - pub use aya_log_ebpf_macros::log; + + const LOG_BUF_CAPACITY: LogValueLength = 8192; + + #[repr(C)] + pub struct LogBuf { + pub buf: [u8; LOG_BUF_CAPACITY as usize], + } + + // This cfg_attr prevents compilation failures on macOS where the generated section name doesn't + // meet mach-o's requirements. We wouldn't ordinarily build this crate for macOS, but we do so + // because the integration-test crate depends on this crate transitively. See comment in + // test/integration-test/Cargo.toml. + #[cfg_attr(target_arch = "bpf", map)] + pub static AYA_LOG_BUF: PerCpuArray = PerCpuArray::with_max_entries(1, 0); + + // This cfg_attr prevents compilation failures on macOS where the generated section name doesn't + // meet mach-o's requirements. We wouldn't ordinarily build this crate for macOS, but we do so + // because the integration-test crate depends on this crate transitively. See comment in + // test/integration-test/Cargo.toml. + #[cfg_attr(target_arch = "bpf", map)] + pub static AYA_LOGS: RingBuf = RingBuf::with_byte_size((LOG_BUF_CAPACITY as u32) << 4, 0); } diff --git a/test/integration-test/Cargo.toml b/test/integration-test/Cargo.toml index dd1e5447c..6fb01a053 100644 --- a/test/integration-test/Cargo.toml +++ b/test/integration-test/Cargo.toml @@ -33,7 +33,12 @@ rbpf = { workspace = true } scopeguard = { workspace = true } test-case = { workspace = true } test-log = { workspace = true, features = ["log"] } -tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] } +tokio = { workspace = true, features = [ + "macros", + "net", + "rt-multi-thread", + "time", +] } xdpilone = { workspace = true } [build-dependencies] diff --git a/test/integration-test/src/tests/log.rs b/test/integration-test/src/tests/log.rs index 01820b63f..1f8630eb6 100644 --- a/test/integration-test/src/tests/log.rs +++ b/test/integration-test/src/tests/log.rs @@ -1,7 +1,4 @@ -use std::{ - borrow::Cow, - sync::{Arc, Mutex}, -}; +use std::{borrow::Cow, sync::Mutex}; use aya::{Ebpf, programs::UProbe}; use aya_log::EbpfLogger; @@ -15,10 +12,10 @@ pub extern "C" fn trigger_ebpf_program() { } struct TestingLogger { - log: F, + log: Mutex, } -impl Log for TestingLogger { +impl Log for TestingLogger { fn enabled(&self, _metadata: &log::Metadata) -> bool { true } @@ -27,6 +24,7 @@ impl Log for TestingLogger { fn log(&self, record: &Record) { let Self { log } = self; + let mut log = log.lock().unwrap(); log(record); } } @@ -38,28 +36,21 @@ struct CapturedLog<'a> { pub target: Cow<'a, str>, } -#[test(tokio::test)] -async fn log() { +#[test] +fn log() { let mut bpf = Ebpf::load(crate::LOG).unwrap(); - let captured_logs = Arc::new(Mutex::new(Vec::new())); - { - let captured_logs = captured_logs.clone(); - EbpfLogger::init_with_logger( - &mut bpf, - TestingLogger { - log: move |record: &Record| { - let mut logs = captured_logs.lock().unwrap(); - logs.push(CapturedLog { - body: format!("{}", record.args()).into(), - level: record.level(), - target: record.target().to_string().into(), - }); - }, - }, - ) - .unwrap(); - } + let mut captured_logs = Vec::new(); + let logger = TestingLogger { + log: Mutex::new(|record: &Record| { + captured_logs.push(CapturedLog { + body: format!("{}", record.args()).into(), + level: record.level(), + target: record.target().to_string().into(), + }); + }), + }; + let mut logger = EbpfLogger::init_with_logger(&mut bpf, &logger).unwrap(); let prog: &mut UProbe = bpf.program_mut("test_log").unwrap().try_into().unwrap(); prog.load().unwrap(); @@ -69,21 +60,9 @@ async fn log() { // Call the function that the uprobe is attached to, so it starts logging. trigger_ebpf_program(); - let mut logs = 0; - let records = loop { - tokio::time::sleep(std::time::Duration::from_millis(100)).await; - let records = captured_logs.lock().unwrap(); - let len = records.len(); - if len == 0 { - continue; - } - if len == logs { - break records; - } - logs = len; - }; + logger.flush(); - let mut records = records.iter(); + let mut records = captured_logs.iter(); assert_eq!( records.next(), diff --git a/xtask/public-api/aya-log-common.txt b/xtask/public-api/aya-log-common.txt index 7f383ee0b..c93ec712e 100644 --- a/xtask/public-api/aya-log-common.txt +++ b/xtask/public-api/aya-log-common.txt @@ -177,7 +177,6 @@ impl core::clone::CloneToUninit for aya_log_common::RecordField where T: core pub unsafe fn aya_log_common::RecordField::clone_to_uninit(&self, dest: *mut u8) impl core::convert::From for aya_log_common::RecordField pub fn aya_log_common::RecordField::from(t: T) -> T -pub const aya_log_common::LOG_BUF_CAPACITY: usize pub const aya_log_common::LOG_FIELDS: usize pub trait aya_log_common::DefaultFormatter impl aya_log_common::DefaultFormatter for &str diff --git a/xtask/public-api/aya-log-ebpf.txt b/xtask/public-api/aya-log-ebpf.txt index a395e7f5b..f28801c03 100644 --- a/xtask/public-api/aya-log-ebpf.txt +++ b/xtask/public-api/aya-log-ebpf.txt @@ -1,7 +1,4 @@ pub mod aya_log_ebpf -pub use aya_log_ebpf::LOG_BUF_CAPACITY -pub use aya_log_ebpf::Level -pub use aya_log_ebpf::WriteToBuf pub use aya_log_ebpf::debug pub use aya_log_ebpf::error pub use aya_log_ebpf::info diff --git a/xtask/public-api/aya-log.txt b/xtask/public-api/aya-log.txt index fa8c89b94..089954285 100644 --- a/xtask/public-api/aya-log.txt +++ b/xtask/public-api/aya-log.txt @@ -1,15 +1,11 @@ pub mod aya_log pub enum aya_log::Error -pub aya_log::Error::InvalidOnlineCpu(std::io::error::Error) pub aya_log::Error::MapError(aya::maps::MapError) pub aya_log::Error::MapNotFound -pub aya_log::Error::PerfBufferError(aya::maps::perf::perf_buffer::PerfBufferError) pub aya_log::Error::ProgramError(aya::programs::ProgramError) pub aya_log::Error::ProgramNotFound impl core::convert::From for aya_log::Error pub fn aya_log::Error::from(source: aya::maps::MapError) -> Self -impl core::convert::From for aya_log::Error -pub fn aya_log::Error::from(source: aya::maps::perf::perf_buffer::PerfBufferError) -> Self impl core::convert::From for aya_log::Error pub fn aya_log::Error::from(source: aya::programs::ProgramError) -> Self impl core::error::Error for aya_log::Error @@ -67,34 +63,38 @@ impl core::borrow::BorrowMut for aya_log::DefaultFormatter where T: ?core: pub fn aya_log::DefaultFormatter::borrow_mut(&mut self) -> &mut T impl core::convert::From for aya_log::DefaultFormatter pub fn aya_log::DefaultFormatter::from(t: T) -> T -pub struct aya_log::EbpfLogger -impl aya_log::EbpfLogger -pub fn aya_log::EbpfLogger::init(bpf: &mut aya::bpf::Ebpf) -> core::result::Result -pub fn aya_log::EbpfLogger::init_from_id(program_id: u32) -> core::result::Result -pub fn aya_log::EbpfLogger::init_from_id_with_logger(program_id: u32, logger: T) -> core::result::Result -pub fn aya_log::EbpfLogger::init_with_logger(bpf: &mut aya::bpf::Ebpf, logger: T) -> core::result::Result -impl core::marker::Freeze for aya_log::EbpfLogger -impl core::marker::Send for aya_log::EbpfLogger -impl core::marker::Sync for aya_log::EbpfLogger -impl core::marker::Unpin for aya_log::EbpfLogger -impl core::panic::unwind_safe::RefUnwindSafe for aya_log::EbpfLogger -impl core::panic::unwind_safe::UnwindSafe for aya_log::EbpfLogger -impl core::convert::Into for aya_log::EbpfLogger where U: core::convert::From -pub fn aya_log::EbpfLogger::into(self) -> U -impl core::convert::TryFrom for aya_log::EbpfLogger where U: core::convert::Into -pub type aya_log::EbpfLogger::Error = core::convert::Infallible -pub fn aya_log::EbpfLogger::try_from(value: U) -> core::result::Result>::Error> -impl core::convert::TryInto for aya_log::EbpfLogger where U: core::convert::TryFrom -pub type aya_log::EbpfLogger::Error = >::Error -pub fn aya_log::EbpfLogger::try_into(self) -> core::result::Result>::Error> -impl core::any::Any for aya_log::EbpfLogger where T: 'static + ?core::marker::Sized -pub fn aya_log::EbpfLogger::type_id(&self) -> core::any::TypeId -impl core::borrow::Borrow for aya_log::EbpfLogger where T: ?core::marker::Sized -pub fn aya_log::EbpfLogger::borrow(&self) -> &T -impl core::borrow::BorrowMut for aya_log::EbpfLogger where T: ?core::marker::Sized -pub fn aya_log::EbpfLogger::borrow_mut(&mut self) -> &mut T -impl core::convert::From for aya_log::EbpfLogger -pub fn aya_log::EbpfLogger::from(t: T) -> T +pub struct aya_log::EbpfLogger +impl aya_log::EbpfLogger<&'static dyn log::Log> +pub fn aya_log::EbpfLogger<&'static dyn log::Log>::init(bpf: &mut aya::bpf::Ebpf) -> core::result::Result +pub fn aya_log::EbpfLogger<&'static dyn log::Log>::init_from_id(program_id: u32) -> core::result::Result +impl aya_log::EbpfLogger +pub fn aya_log::EbpfLogger::flush(&mut self) +pub fn aya_log::EbpfLogger::init_from_id_with_logger(program_id: u32, logger: T) -> core::result::Result +pub fn aya_log::EbpfLogger::init_with_logger(bpf: &mut aya::bpf::Ebpf, logger: T) -> core::result::Result +impl std::os::fd::raw::AsRawFd for aya_log::EbpfLogger +pub fn aya_log::EbpfLogger::as_raw_fd(&self) -> std::os::fd::raw::RawFd +impl core::marker::Freeze for aya_log::EbpfLogger where T: core::marker::Freeze +impl core::marker::Send for aya_log::EbpfLogger where T: core::marker::Send +impl core::marker::Sync for aya_log::EbpfLogger where T: core::marker::Sync +impl core::marker::Unpin for aya_log::EbpfLogger where T: core::marker::Unpin +impl core::panic::unwind_safe::RefUnwindSafe for aya_log::EbpfLogger where T: core::panic::unwind_safe::RefUnwindSafe +impl core::panic::unwind_safe::UnwindSafe for aya_log::EbpfLogger where T: core::panic::unwind_safe::UnwindSafe +impl core::convert::Into for aya_log::EbpfLogger where U: core::convert::From +pub fn aya_log::EbpfLogger::into(self) -> U +impl core::convert::TryFrom for aya_log::EbpfLogger where U: core::convert::Into +pub type aya_log::EbpfLogger::Error = core::convert::Infallible +pub fn aya_log::EbpfLogger::try_from(value: U) -> core::result::Result>::Error> +impl core::convert::TryInto for aya_log::EbpfLogger where U: core::convert::TryFrom +pub type aya_log::EbpfLogger::Error = >::Error +pub fn aya_log::EbpfLogger::try_into(self) -> core::result::Result>::Error> +impl core::any::Any for aya_log::EbpfLogger where T: 'static + ?core::marker::Sized +pub fn aya_log::EbpfLogger::type_id(&self) -> core::any::TypeId +impl core::borrow::Borrow for aya_log::EbpfLogger where T: ?core::marker::Sized +pub fn aya_log::EbpfLogger::borrow(&self) -> &T +impl core::borrow::BorrowMut for aya_log::EbpfLogger where T: ?core::marker::Sized +pub fn aya_log::EbpfLogger::borrow_mut(&mut self) -> &mut T +impl core::convert::From for aya_log::EbpfLogger +pub fn aya_log::EbpfLogger::from(t: T) -> T pub struct aya_log::Ipv4Formatter impl aya_log::Formatter for aya_log::Ipv4Formatter where T: core::convert::Into pub fn aya_log::Ipv4Formatter::format(v: T) -> alloc::string::String @@ -315,4 +315,4 @@ impl aya_log::Formatter for aya_log::LowerHexFormatter where T: core::fmt: pub fn aya_log::LowerHexFormatter::format(v: T) -> alloc::string::String impl aya_log::Formatter for aya_log::UpperHexFormatter where T: core::fmt::UpperHex pub fn aya_log::UpperHexFormatter::format(v: T) -> alloc::string::String -pub type aya_log::BpfLogger = aya_log::EbpfLogger +pub type aya_log::BpfLogger = aya_log::EbpfLogger diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index 56dfa3cd9..9fad0a43f 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -608,6 +608,8 @@ pub fn aya::maps::ring_buf::RingBuf<&'a aya::maps::MapData>::try_from(map: &'a a impl<'a> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData> pub type aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData>::Error = aya::maps::MapError pub fn aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result +impl> std::os::fd::owned::AsFd for aya::maps::ring_buf::RingBuf +pub fn aya::maps::ring_buf::RingBuf::as_fd(&self) -> std::os::fd::owned::BorrowedFd<'_> impl> std::os::fd::raw::AsRawFd for aya::maps::ring_buf::RingBuf pub fn aya::maps::ring_buf::RingBuf::as_raw_fd(&self) -> std::os::fd::raw::RawFd impl core::marker::Freeze for aya::maps::ring_buf::RingBuf where T: core::marker::Freeze @@ -2220,6 +2222,8 @@ pub fn aya::maps::ring_buf::RingBuf<&'a aya::maps::MapData>::try_from(map: &'a a impl<'a> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData> pub type aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData>::Error = aya::maps::MapError pub fn aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result +impl> std::os::fd::owned::AsFd for aya::maps::ring_buf::RingBuf +pub fn aya::maps::ring_buf::RingBuf::as_fd(&self) -> std::os::fd::owned::BorrowedFd<'_> impl> std::os::fd::raw::AsRawFd for aya::maps::ring_buf::RingBuf pub fn aya::maps::ring_buf::RingBuf::as_raw_fd(&self) -> std::os::fd::raw::RawFd impl core::marker::Freeze for aya::maps::ring_buf::RingBuf where T: core::marker::Freeze