pub struct ProcessTable { /* private fields */ }Expand description
Implementations§
Source§impl ProcessTable
impl ProcessTable
Sourcepub fn new(max_processes: u32) -> Self
pub fn new(max_processes: u32) -> Self
Create a new process table with the given maximum capacity.
Sourcepub fn allocate_pid(&self) -> Pid
pub fn allocate_pid(&self) -> Pid
Allocate the next PID without inserting an entry.
Sourcepub fn insert(&self, entry: ProcessEntry) -> Result<Pid, KernelError>
pub fn insert(&self, entry: ProcessEntry) -> Result<Pid, KernelError>
Insert a process entry into the table.
The entry’s pid field is set to the next available PID.
Returns the assigned PID, or an error if the process table
is at capacity.
Sourcepub fn insert_with_pid(&self, entry: ProcessEntry) -> Result<(), KernelError>
pub fn insert_with_pid(&self, entry: ProcessEntry) -> Result<(), KernelError>
Insert a process entry with a specific PID (for kernel PID 0).
Sourcepub fn get(&self, pid: Pid) -> Option<ProcessEntry>
pub fn get(&self, pid: Pid) -> Option<ProcessEntry>
Get a clone of a process entry by PID.
Sourcepub fn remove(&self, pid: Pid) -> Option<ProcessEntry>
pub fn remove(&self, pid: Pid) -> Option<ProcessEntry>
Remove a process entry by PID.
Sourcepub fn list(&self) -> Vec<ProcessEntry>
pub fn list(&self) -> Vec<ProcessEntry>
List all process entries (cloned).
Sourcepub fn update_state(
&self,
pid: Pid,
new_state: ProcessState,
) -> Result<(), KernelError>
pub fn update_state( &self, pid: Pid, new_state: ProcessState, ) -> Result<(), KernelError>
Update the state of a process.
Validates the state transition before applying.
Sourcepub fn update_resources(
&self,
pid: Pid,
usage: ResourceUsage,
) -> Result<(), KernelError>
pub fn update_resources( &self, pid: Pid, usage: ResourceUsage, ) -> Result<(), KernelError>
Update resource usage for a process.
Sourcepub fn max_processes(&self) -> u32
pub fn max_processes(&self) -> u32
Get the maximum process capacity.
Sourcepub fn set_capabilities(
&self,
pid: Pid,
capabilities: AgentCapabilities,
) -> Result<(), KernelError>
pub fn set_capabilities( &self, pid: Pid, capabilities: AgentCapabilities, ) -> Result<(), KernelError>
Update the capabilities of a process.
Replaces the existing capabilities with the given ones. This is used by the supervisor when hot-updating an agent’s permissions (future work) or during restart.
Sourcepub fn count_by_state(&self, state: &ProcessState) -> usize
pub fn count_by_state(&self, state: &ProcessState) -> usize
Count processes in the given state.
Auto Trait Implementations§
impl !Freeze for ProcessTable
impl !RefUnwindSafe for ProcessTable
impl Send for ProcessTable
impl Sync for ProcessTable
impl Unpin for ProcessTable
impl UnsafeUnpin for ProcessTable
impl UnwindSafe for ProcessTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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