Struct shadow_rs::host::process::RunnableProcess

source ·
pub struct RunnableProcess { /* private fields */ }
Expand description

A process that is currently runnable.

Implementations§

source§

impl RunnableProcess

source

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.

source

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.

source

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.

source

pub fn memory_borrow(&self) -> impl Deref<Target = MemoryManager> + '_

source

pub fn memory_borrow_mut(&self) -> impl DerefMut<Target = MemoryManager> + '_

source

pub fn strace_logging_options(&self) -> Option<FmtOptions>

source

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.

source

pub fn native_pid(&self) -> Pid

source

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.

source

pub fn thread_borrow( &self, virtual_tid: ThreadId, ) -> Option<impl Deref<Target = RootedRc<RootedRefCell<Thread>>> + '_>

source

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.

source

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.

source

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.

source

pub fn shmem( &self, ) -> impl Deref<Target = ShMemBlock<'static, ProcessShmem>> + '_

Shared memory for this process.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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.

source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> NoTypeInference for T

source§

type This = T

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

source§

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 T
where U: TryFrom<T>,

source§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V