Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions api/ruxos_posix_api/src/imp/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ pub unsafe fn sys_wait4(
let mut process_map = PROCESS_MAP.lock();
if let Some(task) = process_map.get(&(pid as u64)) {
if task.state() == ruxtask::task::TaskState::Exited {
unsafe {
// lower 8 bits of exit_code is the signal number, while upper 8 bits of exit_code is the exit status
// according to "bits/waitstatus.h" in glibc source code.
// TODO: add signal number to wstatus
wstatus.write(task.exit_code() << 8);
if !wstatus.is_null() {
unsafe {
// lower 8 bits of exit_code is the signal number, while upper 8 bits of exit_code is the exit status
// according to "bits/waitstatus.h" in glibc source code.
// TODO: add signal number to wstatus
wstatus.write(task.exit_code() << 8);
}
}
process_map.remove(&(pid as u64));
return pid;
Expand Down Expand Up @@ -129,11 +131,13 @@ pub unsafe fn sys_wait4(
&& task.state() == ruxtask::task::TaskState::Exited
{
// add to to_remove list
unsafe {
// lower 8 bits of exit_code is the signal number, while upper 8 bits of exit_code is the exit status
// according to "bits/waitstatus.h" in glibc source code.
// TODO: add signal number to wstatus
wstatus.write(task.exit_code() << 8);
if !wstatus.is_null() {
unsafe {
// lower 8 bits of exit_code is the signal number, while upper 8 bits of exit_code is the exit status
// according to "bits/waitstatus.h" in glibc source code.
// TODO: add signal number to wstatus
wstatus.write(task.exit_code() << 8);
}
}
let _ = to_remove.insert(*child_pid);
break;
Expand Down