Number of Running Processes on a Minix system from C code

前端 未结 8 1015
盖世英雄少女心
盖世英雄少女心 2021-01-03 06:14

So, this seemed simple at first, but after crawling Google and here, the answer doesn\'t seem as simple as I first thought.

Basically, I\'m editing a MINIX kernel as

8条回答
  •  离开以前
    2021-01-03 07:00

    struct kinfo kinfo;
    int nr_tasks, nr_procs;
    getsysinfo(PM_PROC_NR, SI_KINFO, &kinfo);
    nr_procs = kinfo.nr_pro;
    

    This will get you the number of processes running

提交回复
热议问题