Struct dynlink::context::Context

source ·
#[repr(C)]
pub struct Context { /* private fields */ }
Expand description

A dynamic linker context, the main state struct for this crate.

Implementations§

source§

impl Context

source

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

source

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

source

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.

source

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

source

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

source

pub fn new(engine: Box<dyn ContextEngine + Send>) -> Self

Construct a new dynamic linker context.

source

pub fn replace_engine(&mut self, engine: Box<dyn ContextEngine + Send>)

Replace the callback engine for this context.

source

pub fn lookup_compartment(&self, name: &str) -> Option<CompartmentId>

Lookup a compartment by name.

source

pub fn get_compartment( &self, id: CompartmentId ) -> Result<&Compartment, DynlinkError>

Get a reference to a compartment back by ID.

source

pub fn get_compartment_mut( &mut self, id: CompartmentId ) -> Result<&mut Compartment, DynlinkError>

Get a mut reference to a compartment back by ID.

source

pub fn lookup_library( &self, comp: CompartmentId, name: &str ) -> Option<LibraryId>

Lookup a library by name

source

pub fn get_library(&self, id: LibraryId) -> Result<&Library, DynlinkError>

Get a reference to a library back by ID.

source

pub fn get_library_mut( &mut self, id: LibraryId ) -> Result<&mut Library, DynlinkError>

Get a mut reference to a library back by ID.

source

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.

source

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).

source

pub fn with_bfs(&self, root_id: LibraryId, f: impl FnMut(&LoadedOrUnloaded))

Traverse the library graph with BFS, calling the callback for each library.

source

pub fn libraries(&self) -> LibraryIter<'_>

source

pub fn add_manual_dependency(&mut self, parent: LibraryId, dependee: LibraryId)

source

pub fn add_compartment( &mut self, name: impl ToString ) -> Result<CompartmentId, DynlinkError>

Create a new compartment with a given name.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more