Fix waitpid and improve debug.

This commit is contained in:
4lDO2
2024-07-11 21:13:32 +02:00
parent 0de23a1141
commit 038ff03996
2 changed files with 7 additions and 6 deletions
+4 -4
View File
@@ -223,8 +223,8 @@ pub fn debug_start([a, b, c, d, e, f]: [usize; 6]) {
let contexts = crate::context::contexts();
if let Some(context_lock) = contexts.current() {
let context = context_lock.read();
if context.name.contains("redoxfs") {
if a == SYS_CLOCK_GETTIME || a == SYS_YIELD {
if context.name.contains("xhcid") {
if a == SYS_CLOCK_GETTIME || a == SYS_YIELD || a == SYS_FUTEX {
false
} else if (a == SYS_WRITE || a == SYS_FSYNC) && (b == 1 || b == 2) {
false
@@ -243,7 +243,7 @@ pub fn debug_start([a, b, c, d, e, f]: [usize; 6]) {
let contexts = crate::context::contexts();
if let Some(context_lock) = contexts.current() {
let context = context_lock.read();
print!("{} ({}): ", context.name, context.pid.get());
print!("{} ({}/{}): ", context.name, context.pid.get(), context.cid.get());
}
// Do format_call outside print! so possible exception handlers cannot reentrantly
@@ -279,7 +279,7 @@ pub fn debug_end([a, b, c, d, e, f]: [usize; 6], result: Result<usize>) {
let contexts = crate::context::contexts();
if let Some(context_lock) = contexts.current() {
let context = context_lock.read();
print!("{} ({}): ", context.name, context.pid.get());
print!("{} ({}/{}): ", context.name, context.pid.get(), context.cid.get());
}
// Do format_call outside print! so possible exception handlers cannot reentrantly
+3 -2
View File
@@ -479,7 +479,7 @@ pub fn waitpid(
let process_lock = process::current()?;
let (ppid, waitpid) = {
let process = process_lock.read();
(process.ppid, Arc::clone(&process.waitpid))
(process.pid, Arc::clone(&process.waitpid))
};
let write_status = |value| {
@@ -515,7 +515,7 @@ pub fn waitpid(
let processes = process::PROCESSES.read();
for (_id, process_lock) in processes.iter() {
let process = process_lock.read();
if process.ppid == ppid {
if process.pgid == ppid {
found = true;
break;
}
@@ -582,6 +582,7 @@ pub fn waitpid(
let process = process_lock.read();
if process.ppid != ppid {
log::info!("HACK");
return Err(Error::new(ECHILD));
// TODO
/*