⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

ProcessTable

Struct ProcessTable 

Source
pub struct ProcessTable {
    pub process_count: AtomicUsize,
    /* private fields */
}
Expand description

Global process table

Fields§

§process_count: AtomicUsize

Number of active processes

Implementations§

Source§

impl ProcessTable

Source

pub const fn new() -> Self

Create a new process table

Source

pub fn add_process(&self, process: Process) -> Result<ProcessId, KernelError>

Add a process to the table

Source

pub fn remove_process(&self, pid: ProcessId) -> Option<Box<Process>>

Remove a process from the table

Source

pub fn get_process(&self, pid: ProcessId) -> Option<&'static Process>

Get a process by PID

Source

pub fn get_process_mut(&self, pid: ProcessId) -> Option<&'static mut Process>

Get mutable access to a process

Source

pub fn exists(&self, pid: ProcessId) -> bool

Check if a process exists

Source

pub fn count(&self) -> usize

Get total number of processes

Source

pub fn find_children(&self, parent_pid: ProcessId) -> Vec<ProcessId>

Find all child processes of a parent

Source

pub fn for_each<F>(&self, f: F)
where F: FnMut(&Process),

Iterate over all processes

Source

pub fn find_by_state(&self, state: ProcessState) -> Vec<ProcessId>

Find processes by state

Source

pub fn reap_zombies(&self) -> Vec<(ProcessId, i32)>

Clean up zombie processes

Trait Implementations§

Source§

impl Default for ProcessTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for ProcessTable

§

impl !RefUnwindSafe for ProcessTable

§

impl Send for ProcessTable

§

impl Sync for ProcessTable

§

impl Unpin for ProcessTable

§

impl !UnwindSafe for ProcessTable

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
§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.