Lines Matching refs:pcb
50 extern void process_exit_sighand(struct process_control_block *pcb);
51 extern void process_exit_signal(struct process_control_block *pcb);
52 extern void initial_proc_init_signal(struct process_control_block *pcb);
76 __attribute__((__section__(".data.init_proc_union"))) = {INITIAL_PROC(initial_proc_union.pcb)};
78 struct process_control_block *initial_proc[MAX_CPU_NUM] = {&initial_proc_union.pcb, 0};
89 uint64_t process_exit_files(struct process_control_block *pcb);
97 uint64_t process_exit_mm(struct process_control_block *pcb);
546 struct process_control_block *pcb = current_pcb; in process_do_exit() local
549 process_exit_files(pcb); in process_do_exit()
550 process_exit_thread(pcb); in process_do_exit()
553 pcb->state = PROC_ZOMBIE; in process_do_exit()
554 pcb->exit_code = code; in process_do_exit()
625 list_init(&initial_proc_union.pcb.list); in process_init()
626 wait_queue_init(&initial_proc_union.pcb.wait_child_proc_exit, NULL); in process_init()
637 initial_proc_union.pcb.state = PROC_RUNNING; in process_init()
638 initial_proc_union.pcb.preempt_count = 0; in process_init()
639 initial_proc_union.pcb.cpu_id = 0; in process_init()
640 initial_proc_union.pcb.virtual_runtime = (1UL << 60); in process_init()
654 struct process_control_block *pcb = initial_proc_union.pcb.next_pcb; in process_find_pcb_by_pid() local
658 for (; pcb != &initial_proc_union.pcb; pcb = pcb->next_pcb) in process_find_pcb_by_pid()
660 if (pcb->pid == pid) in process_find_pcb_by_pid()
661 return pcb; in process_find_pcb_by_pid()
674 int process_wakeup(struct process_control_block *pcb) in process_wakeup() argument
678 BUG_ON(pcb == NULL); in process_wakeup()
679 if (pcb == NULL) in process_wakeup()
682 if (pcb->state & PROC_RUNNING) in process_wakeup()
685 pcb->state |= PROC_RUNNING; in process_wakeup()
686 sched_enqueue(pcb); in process_wakeup()
695 int process_wakeup_immediately(struct process_control_block *pcb) in process_wakeup_immediately() argument
697 if (pcb->state & PROC_RUNNING) in process_wakeup_immediately()
699 int retval = process_wakeup(pcb); in process_wakeup_immediately()
712 uint64_t process_exit_files(struct process_control_block *pcb) in process_exit_files() argument
715 if (!(pcb->flags & PF_VFORK)) in process_exit_files()
720 if (pcb->fds[i] == NULL) in process_exit_files()
722 kfree(pcb->fds[i]); in process_exit_files()
726 memset(pcb->fds, 0, sizeof(struct vfs_file_t *) * PROC_MAX_FD_NUM); in process_exit_files()
735 uint64_t process_exit_mm(struct process_control_block *pcb) in process_exit_mm() argument
737 if (pcb->flags & CLONE_VM) in process_exit_mm()
739 if (pcb->mm == NULL) in process_exit_mm()
744 if (pcb->mm->pgd == NULL) in process_exit_mm()
751 pml4t_t *current_pgd = (pml4t_t *)phys_2_virt(pcb->mm->pgd); in process_exit_mm()
754 struct vm_area_struct *vma = pcb->mm->vmas; in process_exit_mm()
763 mm_unmap_vma(pcb->mm, cur_vma, &pa); in process_exit_mm()
782 if (unlikely(pcb->mm->vmas != NULL)) in process_exit_mm()
787 kfree(pcb->mm); in process_exit_mm()
797 void process_exit_thread(struct process_control_block *pcb) in process_exit_thread() argument
807 int process_release_pcb(struct process_control_block *pcb) in process_release_pcb() argument
810 process_exit_mm(pcb); in process_release_pcb()
811 if ((pcb->flags & PF_KTHREAD)) // 释放内核线程的worker private结构体 in process_release_pcb()
812 free_kthread_struct(pcb); in process_release_pcb()
816 pcb->prev_pcb->next_pcb = pcb->next_pcb; in process_release_pcb()
817 pcb->next_pcb->prev_pcb = pcb->prev_pcb; in process_release_pcb()
818 process_exit_sighand(pcb); in process_release_pcb()
819 process_exit_signal(pcb); in process_release_pcb()
821 kfree(pcb); in process_release_pcb()
854 static void __set_pcb_name(struct process_control_block *pcb, const char *pcb_name) in __set_pcb_name() argument
858 strncpy(pcb->name, pcb_name, PCB_NAME_LEN); in __set_pcb_name()
868 void process_set_pcb_name(struct process_control_block *pcb, const char *pcb_name) in process_set_pcb_name() argument
870 __set_pcb_name(pcb, pcb_name); in process_set_pcb_name()