make ps and top use sanity checking kernel proc table retrieval
This commit is contained in:
parent
8379b08845
commit
f044bd10ef
2 changed files with 5 additions and 4 deletions
|
@ -344,8 +344,8 @@ char *argv[];
|
|||
if (ps_proc == NULL || ps_mproc == NULL || ps_fproc == NULL)
|
||||
err("Out of memory");
|
||||
|
||||
if(getsysinfo(PM_PROC_NR, SI_KPROC_TAB, ps_proc) < 0) {
|
||||
fprintf(stderr, "getsysinfo() for SI_KPROC_TAB failed.\n");
|
||||
if(minix_getkproctab(ps_proc, nr_tasks + nr_procs, 1) < 0) {
|
||||
fprintf(stderr, "minix_getkproctab failed.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -358,10 +358,11 @@ void showtop(int r)
|
|||
#endif
|
||||
|
||||
retry:
|
||||
if(getsysinfo(PM_PROC_NR, SI_KPROC_TAB, proc) < 0) {
|
||||
fprintf(stderr, "getsysinfo() for SI_KPROC_TAB failed.\n");
|
||||
if(minix_getkproctab(proc, PROCS, 1) < 0) {
|
||||
fprintf(stderr, "minix_getkproctab failed.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!preheated) {
|
||||
preheated = 1;
|
||||
memcpy(prev_proc, proc, sizeof(prev_proc));
|
||||
|
|
Loading…
Reference in a new issue