diff --git a/src/safeposix/dispatcher.rs b/src/safeposix/dispatcher.rs index eec402e..6667a7a 100644 --- a/src/safeposix/dispatcher.rs +++ b/src/safeposix/dispatcher.rs @@ -1015,7 +1015,7 @@ pub fn lind_syscall_api( } WAITPID_SYSCALL => { - let pid = arg1 as u64; + let pid = arg1 as i32; let mut status = unsafe { &mut *((start_address + arg2) as *mut i32) }; let options = arg3 as i32; diff --git a/src/safeposix/syscalls/sys_calls.rs b/src/safeposix/syscalls/sys_calls.rs index eb5a80e..ac5c809 100644 --- a/src/safeposix/syscalls/sys_calls.rs +++ b/src/safeposix/syscalls/sys_calls.rs @@ -298,7 +298,7 @@ impl Cage { status } - pub fn waitpid_syscall(&self, cageid: u64, status: &mut i32, options: i32) -> i32 { + pub fn waitpid_syscall(&self, cageid: i32, status: &mut i32, options: i32) -> i32 { let mut zombies = self.zombies.write(); let child_num = self.child_num.load(interface::RustAtomicOrdering::Relaxed); @@ -339,7 +339,7 @@ impl Cage { // if cageid is specified, then we need to look up the zombie list for the id else { // first let's check if the cageid is in the zombie list - if let Some(index) = zombies.iter().position(|zombie| zombie.cageid == cageid) { + if let Some(index) = zombies.iter().position(|zombie| zombie.cageid == cageid as u64) { // find the cage in zombie list, remove it from the list and break zombie_opt = Some(zombies.remove(index)); } else { @@ -348,7 +348,7 @@ impl Cage { // 2. the cage has exited, but it is not the child of this cage, or // 3. the cage does not exist // we need to make sure the child is still running, and it is the child of this cage - let child = interface::cagetable_getref_opt(cageid); + let child = interface::cagetable_getref_opt(cageid as u64); if let Some(child_cage) = child { // make sure the child's parent is correct if child_cage.parent != self.cageid { @@ -372,7 +372,7 @@ impl Cage { zombies = self.zombies.write(); // let's check if the zombie list contains the cage - if let Some(index) = zombies.iter().position(|zombie| zombie.cageid == cageid) { + if let Some(index) = zombies.iter().position(|zombie| zombie.cageid == cageid as u64) { // find the cage in zombie list, remove it from the list and break zombie_opt = Some(zombies.remove(index)); break;