fix behavior of sys_exit about child_tid
@@ -51,15 +51,19 @@ impl Syscall<'_> {
//return Err(SysError::ENOSYS);
}
let parent_tid_ref = unsafe { self.vm().check_write_ptr(parent_tid)? };
- let child_tid_ref = unsafe { self.vm().check_write_ptr(child_tid)? };
- let new_thread = self
+ // child_tid buffer should not be set because CLONE_CHILD_SETTID flag is not specified in the current implementation
+ // let child_tid_ref = unsafe { self.vm().check_write_ptr(child_tid)? };
+ let mut new_thread = self
.thread
.clone(self.tf, newsp, newtls, child_tid as usize);
+ if clone_flags.contains(CloneFlags::CHILD_CLEARTID) {
+ new_thread.clear_child_tid = child_tid as usize;
+ }
let tid = thread_manager().add(new_thread);
thread_manager().detach(tid);
info!("clone: {} -> {}", thread::current().id(), tid);
*parent_tid_ref = tid as u32;
- *child_tid_ref = tid as u32;
+ // *child_tid_ref = tid as u32;
Ok(tid)
}
