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>
impl<K: Kernel> Process<K>
Sourcepub const fn new(
name: &'static str,
memory_config: <K::ThreadState as ThreadState>::MemoryConfig,
object_table: ForeignBox<dyn ObjectTable<K>>,
) -> Self
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.
Sourcepub(super) unsafe fn manually_increment_ref_count(&mut self)
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.
pub fn get_object( &self, kernel: K, handle: u32, ) -> Option<ForeignRc<K::AtomicUsize, dyn KernelObject<K>>>
pub fn reset_objects(&self, kernel: K) -> Result<()>
Sourcepub unsafe fn add_to_thread_list(&mut self, thread: &mut Thread<K>)
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.
pub fn range_has_access( &self, access_type: MemoryRegionType, range: Range<usize>, ) -> bool
Sourcepub fn id(&self) -> usize
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.
Sourcepub const unsafe fn const_id_from_process_address(addr: *const ()) -> *const ()
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.