pub struct RunComp {Show 14 fields
pub sctx: ObjID,
pub instance: ObjID,
pub name: String,
pub compartment_id: CompartmentId,
main: Option<CompThread>,
pub deps: Vec<ObjID>,
comp_config_object: CompConfigObject,
alloc: Talc<ErrOnOom>,
mapped_objects: HashMap<MapInfo, Arc<MapHandleInner>>,
flags: Box<AtomicU64>,
per_thread: HashMap<ObjID, PerThread>,
init_info: Option<(StackObject, usize, Vec<CtorSet>)>,
is_debugging: bool,
pub(crate) use_count: u64,
}
Expand description
A runnable or running compartment.
Fields§
§sctx: ObjID
The security context for this compartment.
instance: ObjID
The instance of the security context.
name: String
The name of this compartment.
compartment_id: CompartmentId
The dynlink ID of this compartment.
main: Option<CompThread>
§deps: Vec<ObjID>
§comp_config_object: CompConfigObject
§alloc: Talc<ErrOnOom>
§mapped_objects: HashMap<MapInfo, Arc<MapHandleInner>>
§flags: Box<AtomicU64>
§per_thread: HashMap<ObjID, PerThread>
§init_info: Option<(StackObject, usize, Vec<CtorSet>)>
§is_debugging: bool
§use_count: u64
Implementations§
Source§impl RunComp
impl RunComp
Sourcepub fn new(
sctx: ObjID,
instance: ObjID,
name: String,
compartment_id: CompartmentId,
deps: Vec<ObjID>,
comp_config_object: CompConfigObject,
flags: u64,
main_stack: StackObject,
entry: usize,
ctors: &[CtorSet],
is_debugging: bool,
) -> Self
pub fn new( sctx: ObjID, instance: ObjID, name: String, compartment_id: CompartmentId, deps: Vec<ObjID>, comp_config_object: CompConfigObject, flags: u64, main_stack: StackObject, entry: usize, ctors: &[CtorSet], is_debugging: bool, ) -> Self
Build a new runtime compartment.
Sourcepub fn get_per_thread(&mut self, id: ObjID) -> &mut PerThread
pub fn get_per_thread(&mut self, id: ObjID) -> &mut PerThread
Get per-thread data in this compartment.
Sourcepub fn clean_per_thread_data(&mut self, id: ObjID)
pub fn clean_per_thread_data(&mut self, id: ObjID)
Remove all per-thread data for a given thread.
Sourcepub fn map_object(
&mut self,
info: MapInfo,
handle: Arc<MapHandleInner>,
) -> Result<Arc<MapHandleInner>, TwzError>
pub fn map_object( &mut self, info: MapInfo, handle: Arc<MapHandleInner>, ) -> Result<Arc<MapHandleInner>, TwzError>
Map an object into this compartment.
Sourcepub fn unmap_object(&mut self, info: MapInfo) -> Option<Arc<MapHandleInner>>
pub fn unmap_object(&mut self, info: MapInfo) -> Option<Arc<MapHandleInner>>
Unmap and object from this compartment.
Sourcepub fn comp_config_ptr(&self) -> *const SharedCompConfig
pub fn comp_config_ptr(&self) -> *const SharedCompConfig
Get a pointer to the compartment config.
Sourcepub fn monitor_new<T: Copy + Sized>(&mut self, data: T) -> Result<*mut T, ()>
pub fn monitor_new<T: Copy + Sized>(&mut self, data: T) -> Result<*mut T, ()>
Allocate some space in the compartment allocator, and initialize it.
Sourcepub fn monitor_new_slice<T: Copy + Sized>(
&mut self,
data: &[T],
) -> Result<*mut T, ()>
pub fn monitor_new_slice<T: Copy + Sized>( &mut self, data: &[T], ) -> Result<*mut T, ()>
Allocate some space in the compartment allocator for a slice, and initialize it.
Sourcepub fn set_flag(&self, val: u64)
pub fn set_flag(&self, val: u64)
Set a flag on this compartment, and wakeup anyone waiting on flag change.
Sourcepub fn cas_flag(&self, old: u64, new: u64) -> Result<u64, u64>
pub fn cas_flag(&self, old: u64, new: u64) -> Result<u64, u64>
Set a flag on this compartment, and wakeup anyone waiting on flag change.
pub fn notify_state_changed(&self)
Sourcepub fn until_change(&self, cur: u64) -> ThreadSyncSleep
pub fn until_change(&self, cur: u64) -> ThreadSyncSleep
Setup a ThreadSyncSleep for waiting until the flag is set. Returns None if the flag is already set.
pub(crate) fn start_main_thread( &mut self, state: u64, tmgr: &mut ThreadMgr, dynlink: &mut Context, args: &[&CStr], env: &[&CStr], suspend_on_start: bool, ) -> Option<bool>
fn build_tls_template(&mut self, dynlink: &mut Context) -> Option<()>
pub fn read_error_code(&self) -> u64
pub fn get_nth_thread_info(&self, n: usize) -> Option<ThreadInfo>
pub fn upcall_handle( &self, frame: &mut UpcallFrame, info: &UpcallData, ) -> Result<Option<ResumeFlags>, TwzError>
pub(crate) fn inc_use_count(&mut self)
pub(crate) fn dec_use_count(&mut self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !Crossing for RunComp
impl Freeze for RunComp
impl !ObjSafe for RunComp
impl RefUnwindSafe for RunComp
impl Send for RunComp
impl StoreCopy for RunComp
impl !Sync for RunComp
impl Unpin for RunComp
impl UnwindSafe for RunComp
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