pub struct KallsymsTable { /* private fields */ }Expand description
Parsed kernel symbol table from /proc/kallsyms.
Per-line lazy lookup is too slow for the live-host pipeline,
which resolves dozens of symbols (sched_class addresses, lock
slowpath entry points, scx_root, etc.) at a single dump time.
KallsymsTable parses once and holds an O(1) name→addr map.
Implementations§
Source§impl KallsymsTable
impl KallsymsTable
Sourcepub fn load_from(env: &LiveHostKernelEnv) -> Result<Self>
pub fn load_from(env: &LiveHostKernelEnv) -> Result<Self>
Read and parse /proc/kallsyms from the configured path on
env. Returns an error when the file is unreadable —
/proc/kallsyms is root-readable only, and unprivileged
callers see a 0-filled file. The parser detects the all-
zeros case and returns an empty map without erroring (so
non-privileged unit tests still get a usable
KallsymsTable even though it can’t resolve anything).
Sourcepub fn load_from_path(path: &Path) -> Result<Self>
pub fn load_from_path(path: &Path) -> Result<Self>
Read and parse a kallsyms file from an explicit path. Useful
for unit tests and for the rare live-host caller that wants
to point at a saved snapshot rather than the live
/proc/kallsyms.
Sourcepub fn parse(raw: &str) -> Self
pub fn parse(raw: &str) -> Self
Parse kallsyms-format text (one HEX TYPE NAME ... line per
symbol) into a name→address map.
Skipped lines (silently, without affecting other symbols):
- lines with fewer than 3 whitespace-separated tokens
- lines whose first token is not a hex-parseable u64
- lines whose address is 0 (the kallsyms-redacted view that unprivileged readers see — addresses are zero-filled by the kernel for non-CAP_SYSLOG callers)
A returned table with len() == 0 is valid: the caller can
detect “kallsyms unreadable” via is_empty() and surface a
permission diagnostic without this layer producing an error.
Sourcepub fn resolve(&self, name: &str) -> Option<u64>
pub fn resolve(&self, name: &str) -> Option<u64>
Look up a symbol by exact name. Returns the kernel virtual
address (u64) or None when the name is not in the table.
Trait Implementations§
Source§impl Clone for KallsymsTable
impl Clone for KallsymsTable
Source§fn clone(&self) -> KallsymsTable
fn clone(&self) -> KallsymsTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for KallsymsTable
impl RefUnwindSafe for KallsymsTable
impl Send for KallsymsTable
impl Sync for KallsymsTable
impl Unpin for KallsymsTable
impl UnwindSafe for KallsymsTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more