#[repr(C)]pub struct Context { /* private fields */ }
Expand description
A dynamic linker context, the main state struct for this crate.
Implementations§
source§impl Context
impl Context
sourcepub fn load_library_in_compartment(
&mut self,
comp_id: CompartmentId,
unlib: UnloadedLibrary
) -> Result<LibraryId, DynlinkError>
pub fn load_library_in_compartment( &mut self, comp_id: CompartmentId, unlib: UnloadedLibrary ) -> Result<LibraryId, DynlinkError>
Load a library into a given compartment. The namer callback resolves names to Backing objects, allowing the caller to hook into the “name-of-dependency” -> backing object pipeline.
source§impl Context
impl Context
sourcepub fn relocate_all(&mut self, root_id: LibraryId) -> Result<(), DynlinkError>
pub fn relocate_all(&mut self, root_id: LibraryId) -> Result<(), DynlinkError>
Iterate through all libraries and process relocations for any libraries that haven’t yet been relocated.
source§impl Context
impl Context
sourcepub fn build_ctors_list(
&self,
root_id: LibraryId
) -> Result<Vec<CtorInfo>, DynlinkError>
pub fn build_ctors_list( &self, root_id: LibraryId ) -> Result<Vec<CtorInfo>, DynlinkError>
Build up a list of constructors to call for a library and its dependencies.
sourcepub fn build_runtime_info(
&self,
root_id: LibraryId,
tls: TlsRegion
) -> Result<RuntimeInitInfo, DynlinkError>
pub fn build_runtime_info( &self, root_id: LibraryId, tls: TlsRegion ) -> Result<RuntimeInitInfo, DynlinkError>
Build the runtime handoff info for bootstrapping the Twizzler runtime.
source§impl Context
impl Context
sourcepub fn lookup_symbol<'a>(
&'a self,
start_id: LibraryId,
name: &str,
lookup_flags: LookupFlags
) -> Result<RelocatedSymbol<'a>, DynlinkError>
pub fn lookup_symbol<'a>( &'a self, start_id: LibraryId, name: &str, lookup_flags: LookupFlags ) -> Result<RelocatedSymbol<'a>, DynlinkError>
Search for a symbol, starting from library denoted by start_id. For normal symbol lookup, this should be the ID of the library that needs a symbol looked up. Flags can be specified which allow control over where to look for the symbol.
source§impl Context
impl Context
sourcepub fn new(engine: Box<dyn ContextEngine + Send>) -> Self
pub fn new(engine: Box<dyn ContextEngine + Send>) -> Self
Construct a new dynamic linker context.
sourcepub fn replace_engine(&mut self, engine: Box<dyn ContextEngine + Send>)
pub fn replace_engine(&mut self, engine: Box<dyn ContextEngine + Send>)
Replace the callback engine for this context.
sourcepub fn lookup_compartment(&self, name: &str) -> Option<CompartmentId>
pub fn lookup_compartment(&self, name: &str) -> Option<CompartmentId>
Lookup a compartment by name.
sourcepub fn get_compartment(
&self,
id: CompartmentId
) -> Result<&Compartment, DynlinkError>
pub fn get_compartment( &self, id: CompartmentId ) -> Result<&Compartment, DynlinkError>
Get a reference to a compartment back by ID.
sourcepub fn get_compartment_mut(
&mut self,
id: CompartmentId
) -> Result<&mut Compartment, DynlinkError>
pub fn get_compartment_mut( &mut self, id: CompartmentId ) -> Result<&mut Compartment, DynlinkError>
Get a mut reference to a compartment back by ID.
sourcepub fn lookup_library(
&self,
comp: CompartmentId,
name: &str
) -> Option<LibraryId>
pub fn lookup_library( &self, comp: CompartmentId, name: &str ) -> Option<LibraryId>
Lookup a library by name
sourcepub fn get_library(&self, id: LibraryId) -> Result<&Library, DynlinkError>
pub fn get_library(&self, id: LibraryId) -> Result<&Library, DynlinkError>
Get a reference to a library back by ID.
sourcepub fn get_library_mut(
&mut self,
id: LibraryId
) -> Result<&mut Library, DynlinkError>
pub fn get_library_mut( &mut self, id: LibraryId ) -> Result<&mut Library, DynlinkError>
Get a mut reference to a library back by ID.
sourcepub fn with_dfs_postorder<R>(
&self,
root_id: LibraryId,
f: impl FnMut(&LoadedOrUnloaded) -> R
) -> Vec<R>
pub fn with_dfs_postorder<R>( &self, root_id: LibraryId, f: impl FnMut(&LoadedOrUnloaded) -> R ) -> Vec<R>
Traverse the library graph with DFS postorder, calling the callback for each library.
sourcepub fn with_dfs_postorder_mut<R>(
&mut self,
root_id: LibraryId,
f: impl FnMut(&mut LoadedOrUnloaded) -> R
) -> Vec<R>
pub fn with_dfs_postorder_mut<R>( &mut self, root_id: LibraryId, f: impl FnMut(&mut LoadedOrUnloaded) -> R ) -> Vec<R>
Traverse the library graph with DFS postorder, calling the callback for each library (mutable ref).
sourcepub fn with_bfs(&self, root_id: LibraryId, f: impl FnMut(&LoadedOrUnloaded))
pub fn with_bfs(&self, root_id: LibraryId, f: impl FnMut(&LoadedOrUnloaded))
Traverse the library graph with BFS, calling the callback for each library.
pub fn libraries(&self) -> LibraryIter<'_> ⓘ
pub fn add_manual_dependency(&mut self, parent: LibraryId, dependee: LibraryId)
sourcepub fn add_compartment(
&mut self,
name: impl ToString
) -> Result<CompartmentId, DynlinkError>
pub fn add_compartment( &mut self, name: impl ToString ) -> Result<CompartmentId, DynlinkError>
Create a new compartment with a given name.