Struct shadow_rs::host::process::RunnableProcess
source · pub struct RunnableProcess { /* private fields */ }
Expand description
A process that is currently runnable.
Implementations§
source§impl RunnableProcess
impl RunnableProcess
sourcepub fn spawn_mthread_for_exec(
&self,
host: &Host,
plugin_path: &CStr,
argv: Vec<CString>,
envv: Vec<CString>,
) -> Result<ManagedThread, Errno>
pub fn spawn_mthread_for_exec( &self, host: &Host, plugin_path: &CStr, argv: Vec<CString>, envv: Vec<CString>, ) -> Result<ManagedThread, Errno>
Spawn a ManagedThread
corresponding to the given exec
syscall
parameters. Intended for use by the exec
syscall handlers. Whether it
succeeds or fails, does not mutate self
, though self
’s strace and
shim log files will be passed into the new ManagedThread
.
In case the native exec
syscall fails, the corresponding error is returned.
sourcepub fn free_unsafe_borrows_flush(&self) -> Result<(), Errno>
pub fn free_unsafe_borrows_flush(&self) -> Result<(), Errno>
This cleans up memory references left over from legacy C code; usually a syscall handler.
Writes the leftover mutable ref to memory (if any), and frees all memory refs.
sourcepub fn free_unsafe_borrows_noflush(&self)
pub fn free_unsafe_borrows_noflush(&self)
This cleans up memory references left over from legacy C code; usually a syscall handler.
Frees all memory refs without writing back to memory.
pub fn memory_borrow(&self) -> impl Deref<Target = MemoryManager> + '_
pub fn memory_borrow_mut(&self) -> impl DerefMut<Target = MemoryManager> + '_
pub fn strace_logging_options(&self) -> Option<FmtOptions>
sourcepub fn with_strace_file<T>(&self, f: impl FnOnce(&mut File) -> T) -> Option<T>
pub fn with_strace_file<T>(&self, f: impl FnOnce(&mut File) -> T) -> Option<T>
If strace logging is disabled, this function will do nothing and return None
.
pub fn native_pid(&self) -> Pid
sourcepub fn first_live_thread_borrow(
&self,
root: &Root,
) -> Option<impl Deref<Target = RootedRc<RootedRefCell<Thread>>> + '_>
pub fn first_live_thread_borrow( &self, root: &Root, ) -> Option<impl Deref<Target = RootedRc<RootedRefCell<Thread>>> + '_>
Returns a dynamically borrowed reference to the first live thread. This is meant primarily for the MemoryManager.
pub fn thread_borrow( &self, virtual_tid: ThreadId, ) -> Option<impl Deref<Target = RootedRc<RootedRefCell<Thread>>> + '_>
sourcepub fn signal(
&self,
host: &Host,
current_thread: Option<&Thread>,
siginfo_t: &siginfo_t,
)
pub fn signal( &self, host: &Host, current_thread: Option<&Thread>, siginfo_t: &siginfo_t, )
Send the signal described in siginfo
to process
. current_thread
should be set if there is one (e.g. if this is being called from a syscall
handler), and None
otherwise (e.g. when called from a timer expiration event).
An event will be scheduled to deliver the signal unless current_thread
is set, and belongs to the process self
, and doesn’t have the signal
blocked. In that the signal will be processed synchronously when
returning from the current syscall.
sourcepub fn add_thread(&self, host: &Host, thread: RootedRc<RootedRefCell<Thread>>)
pub fn add_thread(&self, host: &Host, thread: RootedRc<RootedRefCell<Thread>>)
Adds a new thread to the process and schedules it to run.
Intended for use by clone
.
sourcepub fn new_forked_process(
&self,
host: &Host,
flags: CloneFlags,
exit_signal: Option<Signal>,
new_thread_group_leader: RootedRc<RootedRefCell<Thread>>,
) -> RootedRc<RootedRefCell<Process>>
pub fn new_forked_process( &self, host: &Host, flags: CloneFlags, exit_signal: Option<Signal>, new_thread_group_leader: RootedRc<RootedRefCell<Thread>>, ) -> RootedRc<RootedRefCell<Process>>
Create a new Process
, forked from self
, with the thread new_thread_group_leader
.
sourcepub fn shmem(
&self,
) -> impl Deref<Target = ShMemBlock<'static, ProcessShmem>> + '_
pub fn shmem( &self, ) -> impl Deref<Target = ShMemBlock<'static, ProcessShmem>> + '_
Shared memory for this process.
Trait Implementations§
source§impl ExplicitDrop for RunnableProcess
impl ExplicitDrop for RunnableProcess
type ExplicitDropParam = Host
type ExplicitDropResult = ()
fn explicit_drop( self, host: &Self::ExplicitDropParam, ) -> Self::ExplicitDropResult
Auto Trait Implementations§
impl !Freeze for RunnableProcess
impl !RefUnwindSafe for RunnableProcess
impl Send for RunnableProcess
impl !Sync for RunnableProcess
impl Unpin for RunnableProcess
impl !UnwindSafe for RunnableProcess
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> 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