From aa91ba8a9e7f3a978a1534d9a773f5d788fff3fd Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Sat, 7 May 2022 13:35:47 +0800 Subject: [PATCH] clean comments in kernel, and fix typo in usr app:sig_ctrlc --- os/src/fs/stdio.rs | 2 +- os/src/task/mod.rs | 26 +++++++++++++------------- os/src/trap/mod.rs | 2 +- user/src/bin/sig_ctrlc.rs | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/os/src/fs/stdio.rs b/os/src/fs/stdio.rs index 30846aa2..a869e82c 100644 --- a/os/src/fs/stdio.rs +++ b/os/src/fs/stdio.rs @@ -25,7 +25,7 @@ impl File for Stdin { continue; } else if c == 3 { // 3 is ctrl_c - println!("[K] os/fs/stdio/read: Got Ctrl_C"); + //println!("[K] os/fs/stdio/read: Got Ctrl_C"); current_add_signal(SignalFlags::SIGINT); break; } else { diff --git a/os/src/task/mod.rs b/os/src/task/mod.rs index fb62d755..0a4f9f5e 100644 --- a/os/src/task/mod.rs +++ b/os/src/task/mod.rs @@ -95,10 +95,10 @@ pub fn add_initproc() { pub fn check_signals_error_of_current() -> Option<(i32, &'static str)> { let task = current_task().unwrap(); let task_inner = task.inner_exclusive_access(); - println!( - "[K] check_signals_error_of_current {:?}", - task_inner.signals - ); + // println!( + // "[K] check_signals_error_of_current {:?}", + // task_inner.signals + // ); task_inner.signals.check_error() } @@ -106,10 +106,10 @@ pub fn current_add_signal(signal: SignalFlags) { let task = current_task().unwrap(); let mut task_inner = task.inner_exclusive_access(); task_inner.signals |= signal; - println!( - "[K] current_add_signal:: current task sigflag {:?}", - task_inner.signals - ); + // println!( + // "[K] current_add_signal:: current task sigflag {:?}", + // task_inner.signals + // ); } fn call_kernel_signal_handler(signal: SignalFlags) { @@ -127,10 +127,10 @@ fn call_kernel_signal_handler(signal: SignalFlags) { } } _ => { - println!( - "[K] call_kernel_signal_handler:: current task sigflag {:?}", - task_inner.signals - ); + // println!( + // "[K] call_kernel_signal_handler:: current task sigflag {:?}", + // task_inner.signals + // ); task_inner.killed = true; } } @@ -161,7 +161,7 @@ fn call_user_signal_handler(sig: usize, signal: SignalFlags) { trap_ctx.x[10] = sig; } else { // default action - println!("[K] task/call_user_signal_handler: default action, kill current process"); + //println!("[K] task/call_user_signal_handler: default action, kill current process"); } } diff --git a/os/src/trap/mod.rs b/os/src/trap/mod.rs index 4aa58c77..2ad558cc 100644 --- a/os/src/trap/mod.rs +++ b/os/src/trap/mod.rs @@ -86,7 +86,7 @@ pub fn trap_handler() -> ! { } } // handle signals (handle the sent signal) - println!("[K] trap_handler:: handle_signals"); + //println!("[K] trap_handler:: handle_signals"); handle_signals(); // check error signals (if error then exit) diff --git a/user/src/bin/sig_ctrlc.rs b/user/src/bin/sig_ctrlc.rs index 81b3aadf..4a9e732e 100644 --- a/user/src/bin/sig_ctrlc.rs +++ b/user/src/bin/sig_ctrlc.rs @@ -12,7 +12,7 @@ const LF: u8 = 0x0au8; const CR: u8 = 0x0du8; fn func() { - println!("signal_handler: caught signal SIGINT, and exit(1)"); + println!("signal_handler: caught signal SIGINT, and exit(1)"); exit(1); }