mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
kernel: services: implement Debug for ProcessState
This gives us prettier and more useful displays for ProcessState. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
5a0533d6bc
commit
cc4c0f3c58
1 changed files with 15 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ pub struct SystemServices {
|
||||||
_syscall_depth: usize,
|
_syscall_depth: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Copy, Clone, PartialEq)]
|
||||||
pub enum ProcessState {
|
pub enum ProcessState {
|
||||||
/// This is an unallocated, free process
|
/// This is an unallocated, free process
|
||||||
Free,
|
Free,
|
||||||
|
|
@ -62,6 +62,20 @@ pub enum ProcessState {
|
||||||
Sleeping,
|
Sleeping,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl core::fmt::Debug for ProcessState {
|
||||||
|
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::result::Result<(), core::fmt::Error> {
|
||||||
|
use ProcessState::*;
|
||||||
|
match *self {
|
||||||
|
Free => write!(fmt, "Free"),
|
||||||
|
Allocated => write!(fmt, "Allocated"),
|
||||||
|
Setup(ti) => write!(fmt, "Setup({:?})", ti),
|
||||||
|
Ready(rt) => write!(fmt, "Ready({:b})", rt),
|
||||||
|
Running(rt) => write!(fmt, "Running({:b})", rt),
|
||||||
|
Sleeping => write!(fmt, "Sleeping"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for ProcessState {
|
impl Default for ProcessState {
|
||||||
fn default() -> ProcessState {
|
fn default() -> ProcessState {
|
||||||
ProcessState::Free
|
ProcessState::Free
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue