src/kernel/trap/syscall.c
/**
 * @note syscall_getppid is a syscall used to get
 *       running thread`s PPID.
 * @param trap_frame
 * @syscall_return PPID when success.
 */
@note syscall_getppid is a syscall used to get
running thread`s PPID.
@note syscall_getppid is a syscall used to get running thread ` s PPID .
void syscall_getppid(trap_frame_t * trap_frame){
    thread_t * p = GET_RUNNING_THREAD()->p_thread;
    if(p!=NULL&&p->p_thread!=NULL){
        trap_frame->x10 = p->pid;
    }
    else{
        trap_frame->x10 = 1; 
    }
}
void syscall_getppid ( trap_frame_t * trap_frame ) { thread_t * p = GET_RUNNING_THREAD ( ) -> p_thread ; if ( p != NULL && p -> p_thread != NULL ) { trap_frame -> x10 = p -> pid ; } else { trap_frame -> x10 = 1 ; } }
@note syscall_getppid is a syscall used to get
       running thread`s PPID.
@note syscall_getppid is a syscall used to get running thread ` s PPID .
// don`t need lock. // pid 1 is the init process`s pid