Smp (#23)
* Fire up multiple processors * Use IPIs to wake up secondary processors * Much better exception information * Modifications to show more information on fault * WIP: Use real libstd * Add TLS (not complete) * Add random function, export getpid, cleanup * Do not spin APs until new context * Update rust * Update rust * Use rd/wrfsbase * Implement TLS * Implement compiler builtins and update rust * Update rust * Back to Redox libstd * Update rust
This commit is contained in:
parent
25dc44b348
commit
149b0297a4
54 changed files with 1121 additions and 380 deletions
|
@ -5,12 +5,13 @@ use context;
|
|||
use syscall::error::Result;
|
||||
|
||||
pub fn resource() -> Result<Vec<u8>> {
|
||||
let mut string = format!("{:<6}{:<6}{:<6}{:<6}{:<6}{:<8}{}\n",
|
||||
let mut string = format!("{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<8}{}\n",
|
||||
"PID",
|
||||
"PPID",
|
||||
"UID",
|
||||
"GID",
|
||||
"STAT",
|
||||
"CPU",
|
||||
"MEM",
|
||||
"NAME");
|
||||
{
|
||||
|
@ -18,6 +19,35 @@ pub fn resource() -> Result<Vec<u8>> {
|
|||
for (_id, context_lock) in contexts.iter() {
|
||||
let context = context_lock.read();
|
||||
|
||||
let mut stat_string = String::new();
|
||||
if context.stack.is_some() {
|
||||
stat_string.push('U');
|
||||
} else {
|
||||
stat_string.push('K');
|
||||
}
|
||||
match context.status {
|
||||
context::Status::Runnable => {
|
||||
stat_string.push('R');
|
||||
},
|
||||
context::Status::Blocked => if context.wake.is_some() {
|
||||
stat_string.push('S');
|
||||
} else {
|
||||
stat_string.push('B');
|
||||
},
|
||||
context::Status::Exited(_status) => {
|
||||
stat_string.push('Z');
|
||||
}
|
||||
}
|
||||
if context.running {
|
||||
stat_string.push('+');
|
||||
}
|
||||
|
||||
let cpu_string = if let Some(cpu_id) = context.cpu_id {
|
||||
format!("{}", cpu_id)
|
||||
} else {
|
||||
format!("?")
|
||||
};
|
||||
|
||||
let mut memory = 0;
|
||||
if let Some(ref kfx) = context.kstack {
|
||||
memory += kfx.len();
|
||||
|
@ -49,38 +79,16 @@ pub fn resource() -> Result<Vec<u8>> {
|
|||
format!("{} B", memory)
|
||||
};
|
||||
|
||||
let mut stat_string = String::new();
|
||||
if context.stack.is_some() {
|
||||
stat_string.push('U');
|
||||
} else {
|
||||
stat_string.push('K');
|
||||
}
|
||||
match context.status {
|
||||
context::Status::Runnable => {
|
||||
stat_string.push('R');
|
||||
},
|
||||
context::Status::Blocked => if context.wake.is_some() {
|
||||
stat_string.push('S');
|
||||
} else {
|
||||
stat_string.push('B');
|
||||
},
|
||||
context::Status::Exited(_status) => {
|
||||
stat_string.push('Z');
|
||||
}
|
||||
}
|
||||
if context.running {
|
||||
stat_string.push('+');
|
||||
}
|
||||
|
||||
let name_bytes = context.name.lock();
|
||||
let name = str::from_utf8(&name_bytes).unwrap_or("");
|
||||
|
||||
string.push_str(&format!("{:<6}{:<6}{:<6}{:<6}{:<6}{:<8}{}\n",
|
||||
string.push_str(&format!("{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<8}{}\n",
|
||||
context.id,
|
||||
context.ppid,
|
||||
context.euid,
|
||||
context.egid,
|
||||
stat_string,
|
||||
cpu_string,
|
||||
memory_string,
|
||||
name));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue