shadow_rs::host::process

Struct Process

source
pub struct Process { /* private fields */ }
Expand description

A simulated process.

Implementations§

source§

impl Process

source

pub fn borrow_as_runnable( &self, ) -> Option<impl Deref<Target = RunnableProcess> + '_>

Borrows a reference to the internal RunnableProcess if self is runnable.

source

pub fn borrow_as_zombie( &self, ) -> Option<impl Deref<Target = ZombieProcess> + '_>

Borrows a reference to the internal ZombieProcess if self is a zombie.

source

pub fn spawn( host: &Host, plugin_name: CString, plugin_path: &CStr, argv: Vec<CString>, envv: Vec<CString>, pause_for_debugging: bool, strace_logging_options: Option<FmtOptions>, expected_final_state: ProcessFinalState, ) -> Result<RootedRc<RootedRefCell<Process>>, Errno>

Spawn a new process. The process will be runnable via Self::resume once it has been added to the Host’s process list.

source

pub fn id(&self) -> ProcessId

source

pub fn parent_id(&self) -> ProcessId

source

pub fn set_parent_id(&self, pid: ProcessId)

source

pub fn group_id(&self) -> ProcessId

source

pub fn set_group_id(&self, id: ProcessId)

source

pub fn session_id(&self) -> ProcessId

source

pub fn set_session_id(&self, id: ProcessId)

source

pub fn host_id(&self) -> HostId

source

pub fn dumpable(&self) -> SuidDump

Get process’s “dumpable” state, as manipulated by the prctl operations PR_SET_DUMPABLE and PR_GET_DUMPABLE.

source

pub fn set_dumpable(&self, val: SuidDump)

Set process’s “dumpable” state, as manipulated by the prctl operations PR_SET_DUMPABLE and PR_GET_DUMPABLE.

source

pub fn thread_group_leader_id(&self) -> ThreadId

source

pub fn resume(&self, host: &Host, tid: ThreadId)

Resume execution of tid (if it exists). Should only be called from Host::resume.

source

pub fn stop(&self, host: &Host)

Terminate the Process.

Should only be called from Host::free_all_applications.

source

pub fn signal( &self, host: &Host, current_thread: Option<&Thread>, siginfo_t: &siginfo_t, )

See RunnableProcess::signal.

No-op if the self is a ZombieProcess.

source

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

source

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

source

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

Deprecated wrapper for RunnableProcess::memory_borrow_mut

source

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

Deprecated wrapper for RunnableProcess::memory_borrow

source

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

Deprecated wrapper for RunnableProcess::strace_logging_options

source

pub fn with_strace_file<T>(&self, f: impl FnOnce(&mut File) -> T) -> Option<T>

Deprecated wrapper for RunnableProcess::with_strace_file

source

pub fn native_pid(&self) -> Pid

Deprecated wrapper for RunnableProcess::native_pid

source

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

Deprecated wrapper for RunnableProcess::realtime_timer_borrow

source

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

Deprecated wrapper for RunnableProcess::realtime_timer_borrow_mut

source

pub fn first_live_thread_borrow( &self, root: &Root, ) -> Option<impl Deref<Target = RootedRc<RootedRefCell<Thread>>> + '_>

Deprecated wrapper for RunnableProcess::first_live_thread_borrow

source

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

Deprecated wrapper for RunnableProcess::thread_borrow

source

pub fn free_unsafe_borrows_flush(&self) -> Result<(), Errno>

source

pub fn free_unsafe_borrows_noflush(&self)

source

pub fn physical_address( &self, vptr: ForeignPtr<()>, ) -> ManagedPhysicalMemoryAddr

source

pub fn is_running(&self) -> bool

source

pub fn add_thread(&self, host: &Host, thread: RootedRc<RootedRefCell<Thread>>)

Deprecated wrapper for RunnableProcess::add_thread

source

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

Deprecated wrapper for RunnableProcess::shmem

source

pub fn rusage(&self) -> rusage

Resource usage, as returned e.g. by the getrusage syscall.

source

pub fn exit_signal(&self) -> Option<Signal>

Signal that will be sent to parent process on exit. Typically Some(SIGCHLD).

source

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

source

pub fn set_current_working_dir(&self, path: CString)

Set the process’s working directory. This must be kept in sync with the actual working dir of the native process. See https://github.com/shadow/shadow/issues/2960

source

pub fn update_for_exec( &mut self, host: &Host, tid: ThreadId, mthread: ManagedThread, )

Update self to complete an exec syscall from thread tid, replacing the running managed process with mthread.

Trait Implementations§

source§

impl Drop for Process

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl ExplicitDrop for Process

Auto Trait Implementations§

§

impl !Freeze for Process

§

impl !RefUnwindSafe for Process

§

impl Send for Process

§

impl !Sync for Process

§

impl Unpin for Process

§

impl !UnwindSafe for Process

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