kernel: add s command to print servers

This will print all allocated servers on the system.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2022-04-05 10:36:00 +08:00
parent 532c4a4f1f
commit ce4e40b28a
2 changed files with 14 additions and 1 deletions

View file

@ -272,6 +272,18 @@ fn process_irq_character(b: u8) {
});
println!("{} k total", total_bytes / 1024);
}
b's' => {
println!("Servers in use:");
crate::services::SystemServices::with(|system_services| {
println!(" idx | pid | sid");
println!(" --- + --- + -------------------");
for (idx, server) in system_services.servers.iter().enumerate() {
if let Some(s) = server {
println!(" {:3} | {:3} | {:x?}", idx, s.pid, s.sid);
}
}
});
}
#[cfg(all(feature = "gdbserver", baremetal))]
b'g' => {
println!("Starting GDB server -- attach your debugger now");
@ -288,6 +300,7 @@ fn process_irq_character(b: u8) {
println!(" p | print all processes");
println!(" P | print all processes and threads");
println!(" r | report RAM usage of all processes");
println!(" s | print all allocated servers");
}
_ => {}
}

View file

@ -42,7 +42,7 @@ pub struct SystemServices {
pub processes: [Process; MAX_PROCESS_COUNT],
/// A table of all servers in the system
servers: [Option<Server>; MAX_SERVER_COUNT],
pub servers: [Option<Server>; MAX_SERVER_COUNT],
}
#[derive(Copy, Clone, PartialEq)]