#[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,
allowed_gates: AllowedGates,
load_ctx: &mut LoadCtx,
) -> Result<Vec<LoadIds>, DynlinkError>
pub fn load_library_in_compartment( &mut self, comp_id: CompartmentId, unlib: UnloadedLibrary, allowed_gates: AllowedGates, load_ctx: &mut LoadCtx, ) -> Result<Vec<LoadIds>, DynlinkError>
Load a library into a given compartment.
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,
comp: Option<CompartmentId>,
) -> Result<Vec<CtorSet>, DynlinkError>
pub fn build_ctors_list( &self, root_id: LibraryId, comp: Option<CompartmentId>, ) -> Result<Vec<CtorSet>, 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) -> bool,
)
pub fn with_bfs( &self, root_id: LibraryId, f: impl FnMut(&LoadedOrUnloaded) -> bool, )
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)
pub fn unload_compartment( &mut self, comp_id: CompartmentId, ) -> (Option<Compartment>, Vec<LoadedOrUnloaded>)
Sourcepub fn add_compartment(
&mut self,
name: impl ToString,
new_comp_flags: NewCompartmentFlags,
) -> Result<CompartmentId, DynlinkError>
pub fn add_compartment( &mut self, name: impl ToString, new_comp_flags: NewCompartmentFlags, ) -> Result<CompartmentId, DynlinkError>
Create a new compartment with a given name.
Sourcepub fn compartment_dependencies(
&self,
id: CompartmentId,
) -> Result<Vec<CompartmentId>, DynlinkError>
pub fn compartment_dependencies( &self, id: CompartmentId, ) -> Result<Vec<CompartmentId>, DynlinkError>
Get a list of external compartments that the given compartment depends on.
Auto Trait Implementations§
impl !Crossing for Context
impl Freeze for Context
impl !ObjSafe for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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
§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§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
] or
a color-specific method, such as [OwoColorize::green
], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
] or
a color-specific method, such as [OwoColorize::on_yellow
], Read more