Rename eval to syscall test and fix return value

This commit is contained in:
Zhang Junyang
2023-08-01 15:36:45 +08:00
committed by Tate, Hongliang Tian
parent d2cb607e3c
commit f674874e91
7 changed files with 93 additions and 44 deletions

View File

@ -25,8 +25,8 @@ use crate::{
process::status::ProcessStatus,
thread::{kernel_thread::KernelThreadExt, Thread},
};
use alloc::sync::Arc;
use jinux_frame::{boot, exit_qemu};
use core::sync::atomic::Ordering;
use jinux_frame::{boot, exit_qemu, QemuExitCode};
use process::Process;
extern crate alloc;
@ -89,8 +89,12 @@ fn init_thread() {
loop {
// If initproc becomes zombie, then exit qemu.
if *initproc.status().lock() == ProcessStatus::Zombie {
println!("Exit jinux.");
exit_qemu(jinux_frame::QemuExitCode::Success);
let exit_code = if initproc.exit_code().load(Ordering::Relaxed) == 0 {
QemuExitCode::Success
} else {
QemuExitCode::Failed
};
exit_qemu(exit_code);
}
// We don't have preemptive scheduler now.
// The long running init thread should yield its own execution to allow other tasks to go on.