日期:2014-05-16 浏览次数:20671 次
int process_cnt=0; struct task_struct *task = &init_task; // 全局进程列表 struct task_struct *p; struct list_head *pos; read_lock(&tasklist_lock); list_for_each(pos,&task->tasks) { p = list_entry(pos, struct task_struct, tasks); process_cnt ++; os_printf("%d--->%s\n", p->pid,p->comm); } read_unlock(&tasklist_lock); os_printf("the number of process is:%d \n", process_cnt);