4,441
社区成员
发帖
与我相关
我的任务
分享
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);