From 038ff03996e7e2abff3df35875ddcf069d659322 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Thu, 11 Jul 2024 21:13:32 +0200 Subject: [PATCH] Fix waitpid and improve debug. --- src/syscall/debug.rs | 8 ++++---- src/syscall/process.rs | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/syscall/debug.rs b/src/syscall/debug.rs index 8a0dd5c257..c9dac9a2d0 100644 --- a/src/syscall/debug.rs +++ b/src/syscall/debug.rs @@ -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) { 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 diff --git a/src/syscall/process.rs b/src/syscall/process.rs index fc30d10cec..65ddee4fb5 100644 --- a/src/syscall/process.rs +++ b/src/syscall/process.rs @@ -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 /*