make ps and top use sanity checking kernel proc table retrieval

This commit is contained in:
Ben Gras 2010-06-28 11:05:34 +00:00
parent 8379b08845
commit f044bd10ef
2 changed files with 5 additions and 4 deletions

View file

@ -344,8 +344,8 @@ char *argv[];
if (ps_proc == NULL || ps_mproc == NULL || ps_fproc == NULL) if (ps_proc == NULL || ps_mproc == NULL || ps_fproc == NULL)
err("Out of memory"); err("Out of memory");
if(getsysinfo(PM_PROC_NR, SI_KPROC_TAB, ps_proc) < 0) { if(minix_getkproctab(ps_proc, nr_tasks + nr_procs, 1) < 0) {
fprintf(stderr, "getsysinfo() for SI_KPROC_TAB failed.\n"); fprintf(stderr, "minix_getkproctab failed.\n");
exit(1); exit(1);
} }

View file

@ -358,10 +358,11 @@ void showtop(int r)
#endif #endif
retry: retry:
if(getsysinfo(PM_PROC_NR, SI_KPROC_TAB, proc) < 0) { if(minix_getkproctab(proc, PROCS, 1) < 0) {
fprintf(stderr, "getsysinfo() for SI_KPROC_TAB failed.\n"); fprintf(stderr, "minix_getkproctab failed.\n");
exit(1); exit(1);
} }
if (!preheated) { if (!preheated) {
preheated = 1; preheated = 1;
memcpy(prev_proc, proc, sizeof(prev_proc)); memcpy(prev_proc, proc, sizeof(prev_proc));