diff --git a/user/src/bin/forktest2.rs b/user/src/bin/forktest2.rs index 493fccd8..d08a4120 100644 --- a/user/src/bin/forktest2.rs +++ b/user/src/bin/forktest2.rs @@ -22,12 +22,12 @@ pub fn main() -> i32 { } } - let mut xstate: i32 = 0; + let mut exit_code: i32 = 0; for _ in 0..NUM { - assert!(wait(&mut xstate) > 0); - assert_eq!(xstate, 0); + assert!(wait(&mut exit_code) > 0); + assert_eq!(exit_code, 0); } - assert!(wait(&mut xstate) < 0); + assert!(wait(&mut exit_code) < 0); println!("forktest2 test passed!"); 0 } \ No newline at end of file diff --git a/user/src/bin/forktest_simple.rs b/user/src/bin/forktest_simple.rs index 1851aea0..821fba64 100644 --- a/user/src/bin/forktest_simple.rs +++ b/user/src/bin/forktest_simple.rs @@ -18,11 +18,11 @@ pub fn main() -> i32 { 100 } else { // parent process - let mut xstate: i32 = 0; + let mut exit_code: i32 = 0; println!("ready waiting on parent process!"); - assert_eq!(pid, wait(&mut xstate)); - assert_eq!(xstate, 100); - println!("child process pid = {}, exit code = {}", pid, xstate); + assert_eq!(pid, wait(&mut exit_code)); + assert_eq!(exit_code, 100); + println!("child process pid = {}, exit code = {}", pid, exit_code); 0 } } \ No newline at end of file diff --git a/user/src/bin/matrix.rs b/user/src/bin/matrix.rs index 95904337..8ef2c044 100644 --- a/user/src/bin/matrix.rs +++ b/user/src/bin/matrix.rs @@ -56,13 +56,13 @@ pub fn main() -> i32 { println!("fork ok."); - let mut xstate: i32 = 0; + let mut exit_code: i32 = 0; for _ in 0..NUM { - if wait(&mut xstate) < 0 { + if wait(&mut exit_code) < 0 { panic!("wait failed."); } } - assert!(wait(&mut xstate) < 0); + assert!(wait(&mut exit_code) < 0); println!("matrix passed."); 0 } \ No newline at end of file diff --git a/user/src/bin/sleep.rs b/user/src/bin/sleep.rs index d05d6248..bd1e2204 100644 --- a/user/src/bin/sleep.rs +++ b/user/src/bin/sleep.rs @@ -19,11 +19,11 @@ fn sleepy() { pub fn main() -> i32 { let current_time = get_time(); let pid = fork(); - let mut xstate: i32 = 0; + let mut exit_code: i32 = 0; if pid == 0 { sleepy(); } - assert!(waitpid(pid as usize, &mut xstate) == pid && xstate == 0); + assert!(waitpid(pid as usize, &mut exit_code) == pid && exit_code == 0); println!("use {} msecs.", get_time() - current_time); println!("sleep pass."); 0 diff --git a/user/src/bin/usertests.rs b/user/src/bin/usertests.rs index d5d0d7d2..7a4a6d7b 100644 --- a/user/src/bin/usertests.rs +++ b/user/src/bin/usertests.rs @@ -29,10 +29,10 @@ pub fn main() -> i32 { exec(*test); panic!("unreachable!"); } else { - let mut xstate: i32 = Default::default(); - let wait_pid = waitpid(pid as usize, &mut xstate); + let mut exit_code: i32 = Default::default(); + let wait_pid = waitpid(pid as usize, &mut exit_code); assert_eq!(pid, wait_pid); - println!("\x1b[32mUsertests: Test {} in Process {} exited with code {}\x1b[0m", test, pid, xstate); + println!("\x1b[32mUsertests: Test {} in Process {} exited with code {}\x1b[0m", test, pid, exit_code); } } println!("Usertests passed!");