11//! Process management syscalls
22
33use crate :: {
4- config:: MAX_SYSCALL_NUM ,
54 fs:: { open_file, OpenFlags } ,
65 mm:: { translated_ref, translated_refmut, translated_str} ,
76 task:: {
87 add_task, current_task, current_user_token, exit_current_and_run_next, pid2task,
9- suspend_current_and_run_next, SignalAction , SignalFlags , TaskStatus , MAX_SIG ,
8+ suspend_current_and_run_next, SignalAction , SignalFlags , MAX_SIG ,
109 } ,
1110} ;
1211use alloc:: { string:: String , sync:: Arc , vec:: Vec } ;
@@ -18,17 +17,6 @@ pub struct TimeVal {
1817 pub usec : usize ,
1918}
2019
21- /// Task information
22- #[ allow( dead_code) ]
23- pub struct TaskInfo {
24- /// Task status in it's life cycle
25- status : TaskStatus ,
26- /// The numbers of syscall called by task
27- syscall_times : [ u32 ; MAX_SYSCALL_NUM ] ,
28- /// Total running time of task
29- time : usize ,
30- }
31-
3220pub fn sys_exit ( exit_code : i32 ) -> ! {
3321 trace ! ( "kernel:pid[{}] sys_exit" , current_task( ) . unwrap( ) . pid. 0 ) ;
3422 exit_current_and_run_next ( exit_code) ;
@@ -153,14 +141,6 @@ pub fn sys_get_time(_ts: *mut TimeVal, _tz: usize) -> isize {
153141 -1
154142}
155143
156- /// YOUR JOB: Finish sys_task_info to pass testcases
157- /// HINT: You might reimplement it with virtual memory management.
158- /// HINT: What if [`TaskInfo`] is splitted by two pages ?
159- pub fn sys_task_info ( _ti : * mut TaskInfo ) -> isize {
160- trace ! ( "kernel:pid[{}] sys_task_info NOT IMPLEMENTED" , current_task( ) . unwrap( ) . pid. 0 ) ;
161- -1
162- }
163-
164144/// YOUR JOB: Implement mmap.
165145pub fn sys_mmap ( _start : usize , _len : usize , _port : usize ) -> isize {
166146 trace ! ( "kernel:pid[{}] sys_mmap NOT IMPLEMENTED" , current_task( ) . unwrap( ) . pid. 0 ) ;
0 commit comments