From e992c280cbae7af7e484767a0b79314b14a4de84 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 1 Oct 2024 14:42:31 -0400 Subject: [PATCH] Replace `Arc` with `&'static` --- aya/src/programs/uprobe.rs | 12 +++++------- xtask/public-api/aya.txt | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/aya/src/programs/uprobe.rs b/aya/src/programs/uprobe.rs index 2e63e39e..737166ba 100644 --- a/aya/src/programs/uprobe.rs +++ b/aya/src/programs/uprobe.rs @@ -8,7 +8,7 @@ use std::{ mem, os::{fd::AsFd as _, raw::c_char, unix::ffi::OsStrExt}, path::{Path, PathBuf}, - sync::{Arc, LazyLock}, + sync::LazyLock, }; use libc::pid_t; @@ -29,8 +29,8 @@ use crate::{ const LD_SO_CACHE_FILE: &str = "/etc/ld.so.cache"; -static LD_SO_CACHE: LazyLock>> = - LazyLock::new(|| LdSoCache::load(LD_SO_CACHE_FILE).map_err(Arc::new)); +static LD_SO_CACHE: LazyLock> = + LazyLock::new(|| LdSoCache::load(LD_SO_CACHE_FILE)); const LD_SO_CACHE_HEADER_OLD: &str = "ld.so-1.7.0\0"; const LD_SO_CACHE_HEADER_NEW: &str = "glibc-ld.so.cache1.1"; @@ -140,9 +140,7 @@ fn resolve_attach_path(target: &Path, pid: Option) -> Result, + io_error: &'static io::Error, }, /// The target program could not be found. diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index 4cf53afa..68eb4f9f 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -6067,7 +6067,7 @@ pub aya::programs::uprobe::UProbeError::FileError pub aya::programs::uprobe::UProbeError::FileError::filename: std::path::PathBuf pub aya::programs::uprobe::UProbeError::FileError::io_error: std::io::error::Error pub aya::programs::uprobe::UProbeError::InvalidLdSoCache -pub aya::programs::uprobe::UProbeError::InvalidLdSoCache::io_error: alloc::sync::Arc +pub aya::programs::uprobe::UProbeError::InvalidLdSoCache::io_error: &'static std::io::error::Error pub aya::programs::uprobe::UProbeError::InvalidTarget pub aya::programs::uprobe::UProbeError::InvalidTarget::path: std::path::PathBuf pub aya::programs::uprobe::UProbeError::SymbolError @@ -7343,7 +7343,7 @@ pub aya::programs::UProbeError::FileError pub aya::programs::UProbeError::FileError::filename: std::path::PathBuf pub aya::programs::UProbeError::FileError::io_error: std::io::error::Error pub aya::programs::UProbeError::InvalidLdSoCache -pub aya::programs::UProbeError::InvalidLdSoCache::io_error: alloc::sync::Arc +pub aya::programs::UProbeError::InvalidLdSoCache::io_error: &'static std::io::error::Error pub aya::programs::UProbeError::InvalidTarget pub aya::programs::UProbeError::InvalidTarget::path: std::path::PathBuf pub aya::programs::UProbeError::SymbolError