Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. kernel
  6. Process

Process

Struct Process 

Source
pub struct Process<K: Kernel> {
    pub link: Link,
    pub name: &'static str,
    pub(crate) memory_config: <K::ThreadState as ThreadState>::MemoryConfig,
    object_table: ForeignBox<dyn ObjectTable<K>>,
    pub object: Option<ForeignRc<K::AtomicUsize, ProcessObject<K>>>,
    pub(super) thread_list: UnsafeList<Thread<K>, ProcessThreadListAdapter<K>>,
    pub(super) ref_count: K::AtomicUsize,
    pub(super) state: ProcessState,
    pub(super) join_event: Option<EventSignaler<K>>,
    pub(super) exit_status: Option<ExitStatus>,
}

Fields§

§link: Link§name: &'static str§memory_config: <K::ThreadState as ThreadState>::MemoryConfig§object_table: ForeignBox<dyn ObjectTable<K>>§object: Option<ForeignRc<K::AtomicUsize, ProcessObject<K>>>§thread_list: UnsafeList<Thread<K>, ProcessThreadListAdapter<K>>§ref_count: K::AtomicUsize§state: ProcessState§join_event: Option<EventSignaler<K>>§exit_status: Option<ExitStatus>

Implementations§

Source§

impl<K: Kernel> Process<K>

Source

pub const fn new( name: &'static str, memory_config: <K::ThreadState as ThreadState>::MemoryConfig, object_table: ForeignBox<dyn ObjectTable<K>>, ) -> Self

Creates a new, empty, unregistered process.

Source

pub(super) unsafe fn manually_increment_ref_count(&mut self)

Manually increment the processes refcount

SAFETY: This should only be done by the scheduler to maintain a virtual, reference on the kernel process during initialization.

Source

pub fn get_object( &self, kernel: K, handle: u32, ) -> Option<ForeignRc<K::AtomicUsize, dyn KernelObject<K>>>

Source

pub fn reset_objects(&self, kernel: K) -> Result<()>

Source

pub unsafe fn add_to_thread_list(&mut self, thread: &mut Thread<K>)

§Safety

Caller must ensure exclusive access to the process and thread and all threads in the process’ thread list. This can be accomplished by holding the scheduler lock.

Source

pub fn range_has_access( &self, access_type: MemoryRegionType, range: Range<usize>, ) -> bool

Source

pub fn id(&self) -> usize

A simple ID for debugging purposes, currently the pointer to the thread structure itself.

§Safety

The returned value should not be relied upon as being a valid pointer. Even in the current implementation, id does not expose the pointer’s provenance.

Source

pub const unsafe fn const_id_from_process_address(addr: *const ()) -> *const ()

Computes the ID of a process from its address.

§Safety

This exists to allow process annotations to be generated at compile time for static processes that are initialized at runtime. This should not be called in any other circumstance.

Source

pub fn dump(&self, kernel: K)

Trait Implementations§

Source§

impl<K: Kernel> Adapter<Process<K>> for ProcessListAdapter<K>

Source§

impl<K: Kernel> Send for Process<K>

Source§

impl<K: Kernel> Sync for Process<K>

Auto Trait Implementations§

§

impl<K> !Freeze for Process<K>

§

impl<K> !RefUnwindSafe for Process<K>

§

impl<K> !Unpin for Process<K>

§

impl<K> !UnsafeUnpin for Process<K>

§

impl<K> !UnwindSafe for Process<K>

§

impl<K> Forget for Process<K>

§

impl<K> Move for Process<K>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
Source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

Source§

fn cast_into(self) -> U

§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.