11//! Process management syscalls
2- use crate :: {
3- config:: MAX_SYSCALL_NUM ,
4- task:: {
5- change_program_brk, exit_current_and_run_next, suspend_current_and_run_next, TaskStatus ,
6- } ,
7- } ;
2+ use crate :: task:: { change_program_brk, exit_current_and_run_next, suspend_current_and_run_next} ;
83
94#[ repr( C ) ]
105#[ derive( Debug ) ]
@@ -13,17 +8,6 @@ pub struct TimeVal {
138 pub usec : usize ,
149}
1510
16- /// Task information
17- #[ allow( dead_code) ]
18- pub struct TaskInfo {
19- /// Task status in it's life cycle
20- status : TaskStatus ,
21- /// The numbers of syscall called by task
22- syscall_times : [ u32 ; MAX_SYSCALL_NUM ] ,
23- /// Total running time of task
24- time : usize ,
25- }
26-
2711/// task exits and submit an exit code
2812pub fn sys_exit ( _exit_code : i32 ) -> ! {
2913 trace ! ( "kernel: sys_exit" ) ;
@@ -46,11 +30,10 @@ pub fn sys_get_time(_ts: *mut TimeVal, _tz: usize) -> isize {
4630 -1
4731}
4832
49- /// YOUR JOB : Finish sys_task_info to pass testcases
33+ /// TODO : Finish sys_trace to pass testcases
5034/// HINT: You might reimplement it with virtual memory management.
51- /// HINT: What if [`TaskInfo`] is splitted by two pages ?
52- pub fn sys_task_info ( _ti : * mut TaskInfo ) -> isize {
53- trace ! ( "kernel: sys_task_info NOT IMPLEMENTED YET!" ) ;
35+ pub fn sys_trace ( _trace_request : usize , _id : usize , _data : usize ) -> isize {
36+ trace ! ( "kernel: sys_trace" ) ;
5437 -1
5538}
5639
0 commit comments